Skip to content

Commit

Permalink
SERVER-70121 SERVER-70083 Fix basic package tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Egesdahl authored and Evergreen Agent committed Oct 15, 2022
1 parent 25ea623 commit 8d463a6
Show file tree
Hide file tree
Showing 15 changed files with 260 additions and 131 deletions.
222 changes: 156 additions & 66 deletions buildscripts/package_test.py

Large diffs are not rendered by default.

37 changes: 34 additions & 3 deletions buildscripts/package_test_internal.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ def download_extract_package(package: str) -> List[str]:

def run_apt_test(packages: List[str]):
logging.info("Detected apt running test.")
run_and_log("DEBIAN_FRONTEND=noninteractive apt install -y wget")
install_together = ""
for package in packages:
deb_names = download_extract_package(package)
Expand All @@ -63,7 +62,6 @@ def run_apt_test(packages: List[str]):

def run_yum_test(packages: List[str]):
logging.info("Detected yum running test.")
run_and_log("yum install -y wget")
install_together = ""
for package in packages:
rpm_names = download_extract_package(package)
Expand All @@ -73,14 +71,45 @@ def run_yum_test(packages: List[str]):

def run_zypper_test(packages: List[str]):
logging.info("Detected zypper running test.")
run_and_log("zypper -n install wget")
install_together = ""
for package in packages:
rpm_names = download_extract_package(package)
install_together += ' '.join(rpm_names) + " "
run_and_log("zypper -n --no-gpg-checks install {}".format(install_together))


def run_startup_test():
logging.info("Starting mongod.")

# TODO SERVER-70425: We can remove these once we have figured out why
# packager.py sometimes uses distro files from older revisions.
# Remove the PIDFile, PermissionsStartOnly, and Type configurations from
# the systemd service file because they are not needed for simple-type
# (non-forking) services and confuse the systemd emulator script.
run_and_log(
"sed -Ei '/^PIDFile=|PermissionsStartOnly=|Type=/d' $(pkg-config systemd --variable=systemdsystemunitdir)/mongod.service"
)
# Remove the journal: line (and the next) from mongod.conf, which is a
# removed configuration. The Debian version of the config never got updated.
run_and_log("sed -i '/journal:/,+1d' /etc/mongod.conf")
# Remove fork: and pidFilePath: from mongod.conf because we want mongod to be
# a non-forking service under systemd.
run_and_log("sed -Ei '/fork:|pidFilePath:/d' /etc/mongod.conf")

# Overwrite the installed systemd with the emulator script and set up
# the required symlinks so it all works correctly.
# TODO SERVER-70426: Remove these when we have a fake systemd package
# that does all of this for us.
run_and_log("ln -sf /usr/bin/systemctl3.py /bin/systemctl")
run_and_log("ln -sf /usr/bin/systemctl3.py /usr/bin/systemctl")
run_and_log("ln -sf /usr/bin/systemctl3.py /bin/systemd")
run_and_log("ln -sf /usr/bin/systemctl3.py /usr/bin/systemd")
run_and_log("ln -sf /usr/bin/journalctl3.py /bin/journalctl")
run_and_log("ln -sf /usr/bin/journalctl3.py /usr/bin/journalctl")
run_and_log("systemctl enable mongod.service")
run_and_log("systemctl start mongod.service")


package_urls = sys.argv[2:]

if len(package_urls) == 0:
Expand All @@ -101,4 +130,6 @@ def run_zypper_test(packages: List[str]):
logging.error("Found no supported package manager...Failing Test\n")
sys.exit(1)

run_startup_test()

sys.exit(0)
6 changes: 3 additions & 3 deletions buildscripts/simple_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ class Result(TypedDict, total=False):
status: str
exit_code: int
test_file: str
start: int
end: int
elapsed: int
start: float
end: float
elapsed: float
log_raw: str


Expand Down
4 changes: 2 additions & 2 deletions debian/init.d
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ NUMACTL_ARGS="--interleave=all"
if which numactl >/dev/null 2>/dev/null && numactl $NUMACTL_ARGS ls / >/dev/null 2>/dev/null
then
NUMACTL="`which numactl` -- $NUMACTL_ARGS"
DAEMON_OPTS=${DAEMON_OPTS:-"--config $CONF"}
DAEMON_OPTS=${DAEMON_OPTS:-"--config $CONF --fork --pidfilepath $PIDFILE"}
else
NUMACTL=""
DAEMON_OPTS="-- "${DAEMON_OPTS:-"--config $CONF"}
DAEMON_OPTS="-- "${DAEMON_OPTS:-"--config $CONF --fork --pidfilepath $PIDFILE"}
fi


Expand Down
1 change: 0 additions & 1 deletion debian/mongod.service
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ User=mongodb
Group=mongodb
EnvironmentFile=-/etc/default/mongod
ExecStart=/usr/bin/mongod --config /etc/mongod.conf
PIDFile=/var/run/mongodb/mongod.pid
# file size
LimitFSIZE=infinity
# cpu time
Expand Down
1 change: 1 addition & 0 deletions etc/evergreen_yml_components/definitions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1571,6 +1571,7 @@ functions:
- "src/evergreen/run_python_script.sh"
- "buildscripts/package_test.py"
- "--os=none"
- "--arch=${packager_arch}"
- "--extra-test"
- "${packager_distro}"
- "https://s3.amazonaws.com/mciuploads/${project}/${build_variant}/${revision}/artifacts/${build_id}-packages.tgz"
Expand Down
58 changes: 38 additions & 20 deletions etc/evergreen_yml_components/variants/misc_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,8 @@ buildvariants:
- name: .ssl
- name: .stitch
- name: test_packages
distros:
- ubuntu1804-arm64-build
- name: .publish
distros:
- rhel80-small
Expand Down Expand Up @@ -423,6 +425,8 @@ buildvariants:
distros:
- amazon2-arm64-large
- name: test_packages
distros:
- ubuntu1804-arm64-build
- name: .publish
distros:
- rhel80-small
Expand Down Expand Up @@ -472,7 +476,7 @@ buildvariants:
- name: .stitch
- name: test_packages
distros:
- ubuntu2004-package
- ubuntu2204-arm64-large
- name: .publish
distros:
- rhel80-small
Expand Down Expand Up @@ -595,7 +599,7 @@ buildvariants:
- amazon2022-arm64-large
- name: test_packages
distros:
- ubuntu2004-package
- ubuntu2204-arm64-large
- name: .publish
distros:
- rhel80-small
Expand Down Expand Up @@ -777,7 +781,7 @@ buildvariants:
- name: .stitch
- name: test_packages
distros:
- ubuntu2004-package
- ubuntu2204-large
- name: .publish
distros:
- debian11-small
Expand Down Expand Up @@ -841,7 +845,7 @@ buildvariants:
- name: .publish_crypt
- name: test_packages
distros:
- ubuntu2004-package
- ubuntu2204-large
- name: .publish
distros:
- debian11-small
Expand Down Expand Up @@ -946,9 +950,6 @@ buildvariants:
- name: jsCore
- name: sharding_gen
- name: replica_sets_gen
- name: test_packages
distros:
- ubuntu2004-package

- name: rhel80
display_name: RHEL 8.0
Expand Down Expand Up @@ -1175,7 +1176,7 @@ buildvariants:
- name: .stitch
- name: test_packages
distros:
- ubuntu2004-package
- ubuntu1804-arm64-build
- name: .publish
distros:
- rhel80-small
Expand Down Expand Up @@ -1243,6 +1244,8 @@ buildvariants:
- rhel82-arm64-large
- name: .publish_crypt
- name: test_packages
distros:
- ubuntu1804-arm64-build
- name: .publish
distros:
- rhel80-small
Expand Down Expand Up @@ -1293,7 +1296,7 @@ buildvariants:
- name: .stitch
- name: test_packages
distros:
- ubuntu2004-package
- ubuntu2204-large
- name: selinux_rhel9_org
- name: .publish
distros:
Expand Down Expand Up @@ -1370,7 +1373,7 @@ buildvariants:
- name: unittest_shell_hang_analyzer_gen
- name: test_packages
distros:
- ubuntu2004-package
- ubuntu2204-large
- name: selinux_rhel9_enterprise
- name: .publish
distros:
Expand Down Expand Up @@ -1427,6 +1430,9 @@ buildvariants:
- name: .sharding .common !.csrs
- name: .ssl
- name: .stitch
- name: test_packages
distros:
- ubuntu2004-package
- name: .publish
distros:
- suse12-small
Expand Down Expand Up @@ -1810,6 +1816,8 @@ buildvariants:
distros:
- ubuntu1804-test
- name: test_packages
distros:
- ubuntu1804-arm64-build
- name: .publish
distros:
- ubuntu1804-test
Expand Down Expand Up @@ -1849,6 +1857,8 @@ buildvariants:
- name: jsCore
- name: replica_sets_jscore_passthrough
- name: test_packages
distros:
- ubuntu1804-arm64-build
- name: .publish
distros:
- ubuntu1804-test
Expand Down Expand Up @@ -1904,7 +1914,7 @@ buildvariants:
- name: .stitch
- name: test_packages
distros:
- ubuntu2004-package
- ubuntu2204-large
- name: .publish
distros:
- ubuntu2204-small
Expand Down Expand Up @@ -1961,7 +1971,6 @@ buildvariants:
- name: test_packages
distros:
- ubuntu2004-package
- name: test_packages_complete
- name: .publish
distros:
- ubuntu2004-small
Expand Down Expand Up @@ -2094,7 +2103,10 @@ buildvariants:
- name: sharding_auth_gen
- name: test_packages
distros:
- ubuntu2004-package
- ubuntu2204-large
- name: test_packages_complete
distros:
- ubuntu2204-large
- name: .publish
distros:
- ubuntu2204-small
Expand All @@ -2106,7 +2118,7 @@ buildvariants:
modules:
- enterprise
run_on:
- ubuntu2004-arm64-large
- ubuntu1804-arm64-build
expansions:
additional_package_targets: >-
archive-mongocryptd
Expand Down Expand Up @@ -2156,6 +2168,8 @@ buildvariants:
- name: .crypt
- name: .publish_crypt
- name: test_packages
distros:
- ubuntu1804-arm64-build
- name: .publish
distros:
- ubuntu2004-test
Expand All @@ -2165,7 +2179,7 @@ buildvariants:
display_name: Ubuntu 20.04 arm64
cron: "0 4 * * *" # From the ${project_nightly_cron} parameter.
run_on:
- ubuntu2004-arm64-large
- ubuntu1804-arm64-build
expansions:
push_path: linux
push_bucket: downloads.mongodb.org
Expand Down Expand Up @@ -2193,7 +2207,8 @@ buildvariants:
- name: jsCore
- name: replica_sets_jscore_passthrough
- name: test_packages
- name: test_packages_complete
distros:
- ubuntu1804-arm64-build
- name: .publish
distros:
- ubuntu2004-test
Expand All @@ -2212,7 +2227,7 @@ buildvariants:
push_path: linux
push_bucket: downloads.10gen.com
push_name: linux
push_arch: aarch64-enterprise-ubuntu2204
push_arch: arm64-enterprise-ubuntu2204
compile_flags: --ssl MONGO_DISTMOD=ubuntu2204 -j$(grep -c ^processor /proc/cpuinfo) --variables-files=etc/scons/mongodbtoolchain_v3_gcc.vars
crypt_task_compile_flags: SHLINKFLAGS_EXTRA="-Wl,-Bsymbolic -Wl,--no-gnu-unique" CCFLAGS="-fno-gnu-unique"
resmoke_jobs_max: 4 # Avoid starting too many mongod's on ARM test servers
Expand Down Expand Up @@ -2250,7 +2265,10 @@ buildvariants:
- name: .publish_crypt
- name: test_packages
distros:
- ubuntu2004-package
- ubuntu2204-arm64-large
- name: test_packages_complete
distros:
- ubuntu2204-arm64-large
- name: .publish
distros:
- ubuntu2204-small
Expand All @@ -2265,7 +2283,7 @@ buildvariants:
push_path: linux
push_bucket: downloads.mongodb.org
push_name: linux
push_arch: aarch64-ubuntu2204
push_arch: arm64-ubuntu2204
compile_flags: --ssl MONGO_DISTMOD=ubuntu2204 -j$(grep -c ^processor /proc/cpuinfo) --variables-files=etc/scons/mongodbtoolchain_v3_gcc.vars
resmoke_jobs_max: 8 # Avoid starting too many mongod's on ARM test servers
has_packages: true
Expand All @@ -2285,7 +2303,7 @@ buildvariants:
- name: replica_sets_jscore_passthrough
- name: test_packages
distros:
- ubuntu2004-package
- ubuntu2204-arm64-large
- name: .publish
distros:
- ubuntu2204-small
Expand Down
9 changes: 4 additions & 5 deletions rpm/init.d-mongod
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@

. /etc/rc.d/init.d/functions

PIDFILEPATH="/var/run/mongodb/mongod.pid"
PIDDIR=`dirname $PIDFILEPATH`

# NOTE: if you change any OPTIONS here, you get what you pay for:
# this script assumes all options are in the config file.
CONFIGFILE="/etc/mongod.conf"
OPTIONS=" -f $CONFIGFILE"
OPTIONS=" -f $CONFIGFILE --fork --pidfilepath $PIDFILEPATH"

mongod=${MONGOD-/usr/bin/mongod}

Expand All @@ -37,10 +40,6 @@ else
NUMACTL=""
fi

# things from mongod.conf get there by mongod reading it
PIDFILEPATH="`awk -F'[:=]' -v IGNORECASE=1 '/^[[:blank:]]*(processManagement\.)?pidfilepath[[:blank:]]*[:=][[:blank:]]*/{print $2}' \"$CONFIGFILE\" | tr -d \"[:blank:]\\"'\" | awk -F'#' '{print $1}'`"
PIDDIR=`dirname $PIDFILEPATH`
start()
{
# Make sure the default pidfile directory exists
Expand Down
9 changes: 4 additions & 5 deletions rpm/init.d-mongod.suse
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@
. /etc/rc.status
rc_reset

PIDFILEPATH="/var/run/mongodb/mongod.pid"
PIDDIR=`dirname $PIDFILEPATH`

# NOTE: if you change any OPTIONS here, you get what you pay for:
# this script assumes all options are in the config file.
CONFIGFILE="/etc/mongod.conf"
OPTIONS=" -f $CONFIGFILE"
OPTIONS=" -f $CONFIGFILE --fork --pidfilepath $PIDFILEPATH"

mongod=${MONGOD-/usr/bin/mongod}

Expand All @@ -44,10 +47,6 @@ else
NUMACTL=""
fi

# things from mongod.conf get there by mongod reading it
PIDFILEPATH=`awk -F'[:=]' -v IGNORECASE=1 '/^[[:blank:]]*(processManagement\.)?pidfilepath[[:blank:]]*[:=][[:blank:]]*/{print $2}' "$CONFIGFILE" | tr -d "[:blank:]\"'" | awk -F'#' '{print $1}'`
PIDDIR=`dirname $PIDFILEPATH`

start()
{

Expand Down
Loading

0 comments on commit 8d463a6

Please sign in to comment.