summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsergey.galtsev <sergey.galtsev@mongodb.com>2022-05-17 13:22:57 -0700
committersergey.galtsev <sergey.galtsev@mongodb.com>2022-05-18 16:55:24 -0700
commit8d64bcb59bc20faaa590e1a5ed2c99edec4e45a2 (patch)
tree6159bcea5e1da1750ef13fc811f8c95485a8104d
parent79e48dd8b0010e454abd7a7c32bbb97e1714a5fb (diff)
downloadmongo-BACKPORT-12771.tar.gz
SERVER-66488 Update selinux tests to use shell from archive_dist_testBACKPORT-12771
(cherry picked from commit 08e5f964cdb3fd71f7e7d1691797c4ece29ea1d8)
-rw-r--r--etc/evergreen_yml_components/definitions.yml12
-rwxr-xr-xevergreen/selinux_test_executor.sh15
-rwxr-xr-xevergreen/selinux_test_setup.sh9
3 files changed, 25 insertions, 11 deletions
diff --git a/etc/evergreen_yml_components/definitions.yml b/etc/evergreen_yml_components/definitions.yml
index 4a84342dfb6..5d643cd16fb 100644
--- a/etc/evergreen_yml_components/definitions.yml
+++ b/etc/evergreen_yml_components/definitions.yml
@@ -6159,6 +6159,7 @@ tasks:
- name: selinux_rhel8_org
tags: []
depends_on:
+ - name: archive_dist_test
- name: package
commands:
- command: manifest.load
@@ -6166,6 +6167,8 @@ tasks:
- *f_expansions_write
- func: "set up venv"
- func: "fetch packages"
+ - func: "fetch binaries"
+ - func: "extract binaries"
- func: "run selinux tests"
vars:
distro: rhel80-selinux
@@ -6174,6 +6177,7 @@ tasks:
- name: selinux_rhel8_enterprise
tags: []
depends_on:
+ - name: archive_dist_test
- name: package
commands:
- command: manifest.load
@@ -6181,6 +6185,8 @@ tasks:
- *f_expansions_write
- func: "set up venv"
- func: "fetch packages"
+ - func: "fetch binaries"
+ - func: "extract binaries"
- func: "run selinux tests"
vars:
distro: rhel80-selinux
@@ -6189,6 +6195,7 @@ tasks:
- name: selinux_rhel7_org
tags: []
depends_on:
+ - name: archive_dist_test
- name: package
commands:
- command: manifest.load
@@ -6196,6 +6203,8 @@ tasks:
- *f_expansions_write
- func: "set up venv"
- func: "fetch packages"
+ - func: "fetch binaries"
+ - func: "extract binaries"
- func: "run selinux tests"
vars:
user: root
@@ -6205,6 +6214,7 @@ tasks:
- name: selinux_rhel7_enterprise
tags: []
depends_on:
+ - name: archive_dist_test
- name: package
commands:
- command: manifest.load
@@ -6212,6 +6222,8 @@ tasks:
- *f_expansions_write
- func: "set up venv"
- func: "fetch packages"
+ - func: "fetch binaries"
+ - func: "extract binaries"
- func: "run selinux tests"
vars:
user: root
diff --git a/evergreen/selinux_test_executor.sh b/evergreen/selinux_test_executor.sh
index 1ba889a1c80..a0616d314d6 100755
--- a/evergreen/selinux_test_executor.sh
+++ b/evergreen/selinux_test_executor.sh
@@ -3,6 +3,13 @@
set -o errexit
set -o xtrace
+mongo="$(pwd)/dist-test/bin/mongo"
+export PATH="$(dirname "$mongo"):$PATH"
+if [ ! -f "$mongo" ]; then
+ echo "Mongo shell at $mongo is missing"
+ exit 1
+fi
+
function print() {
echo "$@" >&2
}
@@ -19,7 +26,7 @@ if [ ! -f "$TEST_PATH" ]; then
fi
# test file is even good before going on
-if ! mongo --nodb --norc --quiet "$TEST_PATH"; then
+if ! "$mongo" --nodb --norc --quiet "$TEST_PATH"; then
print "File $TEST_PATH has syntax errors"
exit 1
fi
@@ -42,14 +49,14 @@ sudo --non-interactive bash -c '
'
# create mongo config
-mongo --nodb --norc --quiet --eval='
+"$mongo" --nodb --norc --quiet --eval='
assert(load("'"$TEST_PATH"'"));
const test = new TestDefinition();
print(typeof(test.config) === "string" ? test.config : JSON.stringify(test.config, null, 2));
' | sudo --non-interactive tee /etc/mongod.conf
# setup
-mongo --nodb --norc --quiet --eval='
+"$mongo" --nodb --norc --quiet --eval='
assert(load("'"$TEST_PATH"'"));
const test = new TestDefinition();
jsTest.log("Running setup()");
@@ -78,7 +85,7 @@ sudo --non-interactive systemctl start mongod \
)
# run test and teardown
-mongo --norc --gssapiServiceName=mockservice --eval='
+"$mongo" --norc --gssapiServiceName=mockservice --eval='
assert(load("'"$TEST_PATH"'"));
// name is such to prevent collisions
const test_812de7ce = new TestDefinition();
diff --git a/evergreen/selinux_test_setup.sh b/evergreen/selinux_test_setup.sh
index ef2e70df2a9..b3af052617a 100755
--- a/evergreen/selinux_test_setup.sh
+++ b/evergreen/selinux_test_setup.sh
@@ -30,14 +30,9 @@ if [ "$SEORDER" == "0" ]; then
apply_selinux_policy
fi
-# install shell using yum, so that dependencies are pulled
-pkg="$(find "$HOME"/repo -name 'mongodb-*-shell-*.x86_64.rpm' | tee /dev/stderr)"
-sudo --non-interactive yum install --assumeyes "$pkg" \
- || if [ "$?" -gt "1" ]; then exit 1; fi # exit code 1 is OK
-
pkg="$(find "$HOME"/repo -name 'mongodb-*-server-*.x86_64.rpm' | tee /dev/stderr)"
-sudo --non-interactive rpm --install --verbose --verbose --hash --nodeps "$pkg" \
- || if [ "$?" -gt "1" ]; then exit 1; fi # exit code 1 is OK
+sudo --non-interactive rpm --install --verbose --verbose --hash --nodeps "$pkg"
+if [ "$?" -gt "1" ]; then exit 1; fi # exit code 1 is OK
if [ "$SEORDER" == "1" ]; then
apply_selinux_policy