Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip "mongo-*auth*" tests for 6+ where the functionality is removed #13006

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions test/tests/mongo-basics/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,19 @@ if docker run --rm --entrypoint sh "$image" -c 'command -v mongosh > /dev/null';
upsertFunc='function upsert(coll, doc) { return coll.initializeUnorderedBulkOp().find({ _id: doc._id }).upsert().replaceOne(doc).execute() }' # https://www.mongodb.com/docs/manual/reference/method/Bulk.find.upsert/#insert-for-bulk.find.replaceone--
fi

oldEntrypoint=1
if ! docker run --rm --entrypoint grep "$image" -qF 'MONGO_' /usr/local/bin/docker-entrypoint.sh; then
# https://github.com/docker-library/mongo/pull/553 👀
oldEntrypoint=
fi

testDir="$(readlink -f "$(dirname "$BASH_SOURCE")")"
testName="$(basename "$testDir")" # "mongo-basics" or "mongo-auth-basics" or "mongo-tls-auth"
if [[ "$testName" == *auth* ]]; then
if [ -z "$oldEntrypoint" ]; then
echo >&2 'warning: skipping test; auth functionality removed'
exit 0
fi
rootUser="root-$RANDOM"
rootPass="root-$RANDOM-$RANDOM-password"
mongodRunArgs+=(
Expand Down Expand Up @@ -86,6 +96,11 @@ if [[ "$testName" == *tls* ]]; then
fi
fi

if [ -z "$oldEntrypoint" ] && [ "${#mongodCmdArgs[@]}" -gt 0 ]; then
# https://github.com/docker-library/mongo/pull/553#discussion_r951715815
mongodCmdArgs=( --bind_ip_all "${mongodCmdArgs[@]}" )
fi

cid="$(docker run "${mongodRunArgs[@]}" "$image" "${mongodCmdArgs[@]}")"
trap "docker rm -vf $cid > /dev/null" EXIT

Expand Down