mirror of https://github.com/mongodb/mongo
SERVER-66488 Update selinux tests to use shell from archive_dist_test
(cherry picked from commit 08e5f964cdb3fd71f7e7d1691797c4ece29ea1d8)
This commit is contained in:
parent
79e48dd8b0
commit
8d64bcb59b
|
|
@ -6159,6 +6159,7 @@ tasks:
|
||||||
- name: selinux_rhel8_org
|
- name: selinux_rhel8_org
|
||||||
tags: []
|
tags: []
|
||||||
depends_on:
|
depends_on:
|
||||||
|
- name: archive_dist_test
|
||||||
- name: package
|
- name: package
|
||||||
commands:
|
commands:
|
||||||
- command: manifest.load
|
- command: manifest.load
|
||||||
|
|
@ -6166,6 +6167,8 @@ tasks:
|
||||||
- *f_expansions_write
|
- *f_expansions_write
|
||||||
- func: "set up venv"
|
- func: "set up venv"
|
||||||
- func: "fetch packages"
|
- func: "fetch packages"
|
||||||
|
- func: "fetch binaries"
|
||||||
|
- func: "extract binaries"
|
||||||
- func: "run selinux tests"
|
- func: "run selinux tests"
|
||||||
vars:
|
vars:
|
||||||
distro: rhel80-selinux
|
distro: rhel80-selinux
|
||||||
|
|
@ -6174,6 +6177,7 @@ tasks:
|
||||||
- name: selinux_rhel8_enterprise
|
- name: selinux_rhel8_enterprise
|
||||||
tags: []
|
tags: []
|
||||||
depends_on:
|
depends_on:
|
||||||
|
- name: archive_dist_test
|
||||||
- name: package
|
- name: package
|
||||||
commands:
|
commands:
|
||||||
- command: manifest.load
|
- command: manifest.load
|
||||||
|
|
@ -6181,6 +6185,8 @@ tasks:
|
||||||
- *f_expansions_write
|
- *f_expansions_write
|
||||||
- func: "set up venv"
|
- func: "set up venv"
|
||||||
- func: "fetch packages"
|
- func: "fetch packages"
|
||||||
|
- func: "fetch binaries"
|
||||||
|
- func: "extract binaries"
|
||||||
- func: "run selinux tests"
|
- func: "run selinux tests"
|
||||||
vars:
|
vars:
|
||||||
distro: rhel80-selinux
|
distro: rhel80-selinux
|
||||||
|
|
@ -6189,6 +6195,7 @@ tasks:
|
||||||
- name: selinux_rhel7_org
|
- name: selinux_rhel7_org
|
||||||
tags: []
|
tags: []
|
||||||
depends_on:
|
depends_on:
|
||||||
|
- name: archive_dist_test
|
||||||
- name: package
|
- name: package
|
||||||
commands:
|
commands:
|
||||||
- command: manifest.load
|
- command: manifest.load
|
||||||
|
|
@ -6196,6 +6203,8 @@ tasks:
|
||||||
- *f_expansions_write
|
- *f_expansions_write
|
||||||
- func: "set up venv"
|
- func: "set up venv"
|
||||||
- func: "fetch packages"
|
- func: "fetch packages"
|
||||||
|
- func: "fetch binaries"
|
||||||
|
- func: "extract binaries"
|
||||||
- func: "run selinux tests"
|
- func: "run selinux tests"
|
||||||
vars:
|
vars:
|
||||||
user: root
|
user: root
|
||||||
|
|
@ -6205,6 +6214,7 @@ tasks:
|
||||||
- name: selinux_rhel7_enterprise
|
- name: selinux_rhel7_enterprise
|
||||||
tags: []
|
tags: []
|
||||||
depends_on:
|
depends_on:
|
||||||
|
- name: archive_dist_test
|
||||||
- name: package
|
- name: package
|
||||||
commands:
|
commands:
|
||||||
- command: manifest.load
|
- command: manifest.load
|
||||||
|
|
@ -6212,6 +6222,8 @@ tasks:
|
||||||
- *f_expansions_write
|
- *f_expansions_write
|
||||||
- func: "set up venv"
|
- func: "set up venv"
|
||||||
- func: "fetch packages"
|
- func: "fetch packages"
|
||||||
|
- func: "fetch binaries"
|
||||||
|
- func: "extract binaries"
|
||||||
- func: "run selinux tests"
|
- func: "run selinux tests"
|
||||||
vars:
|
vars:
|
||||||
user: root
|
user: root
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,13 @@
|
||||||
set -o errexit
|
set -o errexit
|
||||||
set -o xtrace
|
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() {
|
function print() {
|
||||||
echo "$@" >&2
|
echo "$@" >&2
|
||||||
}
|
}
|
||||||
|
|
@ -19,7 +26,7 @@ if [ ! -f "$TEST_PATH" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# test file is even good before going on
|
# 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"
|
print "File $TEST_PATH has syntax errors"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
@ -42,14 +49,14 @@ sudo --non-interactive bash -c '
|
||||||
'
|
'
|
||||||
|
|
||||||
# create mongo config
|
# create mongo config
|
||||||
mongo --nodb --norc --quiet --eval='
|
"$mongo" --nodb --norc --quiet --eval='
|
||||||
assert(load("'"$TEST_PATH"'"));
|
assert(load("'"$TEST_PATH"'"));
|
||||||
const test = new TestDefinition();
|
const test = new TestDefinition();
|
||||||
print(typeof(test.config) === "string" ? test.config : JSON.stringify(test.config, null, 2));
|
print(typeof(test.config) === "string" ? test.config : JSON.stringify(test.config, null, 2));
|
||||||
' | sudo --non-interactive tee /etc/mongod.conf
|
' | sudo --non-interactive tee /etc/mongod.conf
|
||||||
|
|
||||||
# setup
|
# setup
|
||||||
mongo --nodb --norc --quiet --eval='
|
"$mongo" --nodb --norc --quiet --eval='
|
||||||
assert(load("'"$TEST_PATH"'"));
|
assert(load("'"$TEST_PATH"'"));
|
||||||
const test = new TestDefinition();
|
const test = new TestDefinition();
|
||||||
jsTest.log("Running setup()");
|
jsTest.log("Running setup()");
|
||||||
|
|
@ -78,7 +85,7 @@ sudo --non-interactive systemctl start mongod \
|
||||||
)
|
)
|
||||||
|
|
||||||
# run test and teardown
|
# run test and teardown
|
||||||
mongo --norc --gssapiServiceName=mockservice --eval='
|
"$mongo" --norc --gssapiServiceName=mockservice --eval='
|
||||||
assert(load("'"$TEST_PATH"'"));
|
assert(load("'"$TEST_PATH"'"));
|
||||||
// name is such to prevent collisions
|
// name is such to prevent collisions
|
||||||
const test_812de7ce = new TestDefinition();
|
const test_812de7ce = new TestDefinition();
|
||||||
|
|
|
||||||
|
|
@ -30,14 +30,9 @@ if [ "$SEORDER" == "0" ]; then
|
||||||
apply_selinux_policy
|
apply_selinux_policy
|
||||||
fi
|
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)"
|
pkg="$(find "$HOME"/repo -name 'mongodb-*-server-*.x86_64.rpm' | tee /dev/stderr)"
|
||||||
sudo --non-interactive rpm --install --verbose --verbose --hash --nodeps "$pkg" \
|
sudo --non-interactive rpm --install --verbose --verbose --hash --nodeps "$pkg"
|
||||||
|| if [ "$?" -gt "1" ]; then exit 1; fi # exit code 1 is OK
|
if [ "$?" -gt "1" ]; then exit 1; fi # exit code 1 is OK
|
||||||
|
|
||||||
if [ "$SEORDER" == "1" ]; then
|
if [ "$SEORDER" == "1" ]; then
|
||||||
apply_selinux_policy
|
apply_selinux_policy
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue