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

fix(NODE-4998): use ipv4 in socks5 tests for node 18 #3538

Merged
merged 3 commits into from
Jan 26, 2023
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions .evergreen/config.in.yml
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,7 @@ functions:
export DRIVERS_TOOLS="${DRIVERS_TOOLS}"
export NODE_LTS_NAME='${NODE_LTS_NAME}'
export MONGODB_URI="${MONGODB_URI}"
export TEST_SOCKS5_CSFLE="${TEST_SOCKS5_CSFLE}"
export SSL="${SSL}"

# Disable xtrace (just in case it was accidentally set).
Expand Down
21 changes: 21 additions & 0 deletions .evergreen/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,8 @@ functions:

export MONGODB_URI="${MONGODB_URI}"

export TEST_SOCKS5_CSFLE="${TEST_SOCKS5_CSFLE}"

export SSL="${SSL}"


Expand Down Expand Up @@ -1303,6 +1305,18 @@ tasks:
TOPOLOGY: replica_set
- func: bootstrap kms servers
- func: run socks5 tests
- name: test-socks5-csfle
tags: []
commands:
- func: install dependencies
- func: bootstrap mongo-orchestration
vars:
VERSION: latest
TOPOLOGY: replica_set
- func: bootstrap kms servers
- func: run socks5 tests
vars:
TEST_SOCKS5_CSFLE: 'true'
- name: test-socks5-tls
tags: []
commands:
Expand Down Expand Up @@ -2661,6 +2675,7 @@ buildvariants:
- test-auth-kerberos
- test-auth-ldap
- test-socks5
- test-socks5-csfle
- test-socks5-tls
- test-zstd-compression
- test-snappy-compression
Expand Down Expand Up @@ -2709,6 +2724,7 @@ buildvariants:
- test-auth-kerberos
- test-auth-ldap
- test-socks5
- test-socks5-csfle
- test-socks5-tls
- test-tls-support-latest
- test-tls-support-6.0
Expand Down Expand Up @@ -2754,6 +2770,7 @@ buildvariants:
- test-latest-load-balanced
- test-auth-ldap
- test-socks5
- test-socks5-csfle
- test-socks5-tls
- test-tls-support-latest
- test-tls-support-6.0
Expand Down Expand Up @@ -2798,6 +2815,7 @@ buildvariants:
- test-6.0-load-balanced
- test-latest-load-balanced
- test-auth-ldap
- test-socks5-csfle
- test-socks5-tls
- test-tls-support-latest
- test-tls-support-6.0
Expand Down Expand Up @@ -2838,6 +2856,7 @@ buildvariants:
- test-latest-server-v1-api
- test-atlas-data-lake
- test-socks5
- test-socks5-csfle
- test-socks5-tls
- test-zstd-compression
- test-snappy-compression
Expand Down Expand Up @@ -2880,6 +2899,7 @@ buildvariants:
- test-latest-server-v1-api
- test-atlas-data-lake
- test-socks5
- test-socks5-csfle
- test-socks5-tls
- test-tls-support-latest
- test-tls-support-6.0
Expand Down Expand Up @@ -2920,6 +2940,7 @@ buildvariants:
- test-latest-server-v1-api
- test-atlas-data-lake
- test-socks5
- test-socks5-csfle
- test-socks5-tls
- test-tls-support-latest
- test-tls-support-6.0
Expand Down
21 changes: 21 additions & 0 deletions .evergreen/generate_evergreen_tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,27 @@ TASKS.push(
{ func: 'run socks5 tests' }
]
},
{
name: 'test-socks5-csfle',
tags: [],
commands: [
{ func: 'install dependencies' },
{
func: 'bootstrap mongo-orchestration',
vars: {
VERSION: 'latest',
TOPOLOGY: 'replica_set'
}
},
{ func: 'bootstrap kms servers' },
{
func: 'run socks5 tests',
vars: {
TEST_SOCKS5_CSFLE: 'true'
}
}
]
},
{
name: 'test-socks5-tls',
tags: [],
Expand Down
36 changes: 21 additions & 15 deletions .evergreen/run-socks5-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ fi

# Grab a connection string that only refers to *one* of the hosts in MONGODB_URI
FIRST_HOST=$(node -p 'new (require("mongodb-connection-string-url").default)(process.env.MONGODB_URI).hosts[0]')
# Use localhost:12345 as the URL for the single host that we connect to,
# Use 127.0.0.1:12345 as the URL for the single host that we connect to,
# we configure the Socks5 proxy server script to redirect from this to FIRST_HOST
export MONGODB_URI_SINGLEHOST="mongodb://localhost:12345/"
export MONGODB_URI_SINGLEHOST="mongodb://127.0.0.1:12345/"

# Compute path to socks5 fake server script in a way that works on Windows
SOCKS5_SERVER_SCRIPT="$DRIVERS_TOOLS/.evergreen/socks5srv.py"
Expand All @@ -29,22 +29,28 @@ if [ "Windows_NT" = "$OS" ]; then
fi

# First, test with Socks5 + authentication required
"$PYTHON_BINARY" "$SOCKS5_SERVER_SCRIPT" --port 1080 --auth username:p4ssw0rd --map "localhost:12345 to $FIRST_HOST" &
PID=$!
env SOCKS5_CONFIG='["localhost",1080,"username","p4ssw0rd"]' npm run check:socks5
[ "$SSL" == "nossl" ] && [[ "$OSTYPE" == "linux-gnu"* ]] && \
env MONGODB_URI='mongodb://localhost:12345/?proxyHost=localhost&proxyUsername=username&proxyPassword=p4ssw0rd' \
"$PYTHON_BINARY" "$SOCKS5_SERVER_SCRIPT" --port 1080 --auth username:p4ssw0rd --map "127.0.0.1:12345 to $FIRST_HOST" &
SOCKS5_PROXY_PID=$!
if [[ $TEST_SOCKS5_CSFLE == "true" ]]; then
[ "$SSL" == "nossl" ] && [[ "$OSTYPE" == "linux-gnu"* ]] && \
env MONGODB_URI='mongodb://127.0.0.1:12345/?proxyHost=127.0.0.1&proxyUsername=username&proxyPassword=p4ssw0rd' \
bash "${PROJECT_DIRECTORY}/.evergreen/run-custom-csfle-tests.sh"
kill $PID
else
env SOCKS5_CONFIG='["127.0.0.1",1080,"username","p4ssw0rd"]' npm run check:socks5
fi
kill $SOCKS5_PROXY_PID

# Second, test with Socks5 + no authentication
"$PYTHON_BINARY" "$SOCKS5_SERVER_SCRIPT" --port 1081 --map "localhost:12345 to $FIRST_HOST" &
PID=$!
env SOCKS5_CONFIG='["localhost",1081]' npm run check:socks5
[ "$SSL" == "nossl" ] && [[ "$OSTYPE" == "linux-gnu"* ]] && \
env MONGODB_URI='mongodb://localhost:12345/?proxyHost=localhost&proxyPort=1081' \
bash "${PROJECT_DIRECTORY}/.evergreen/run-custom-csfle-tests.sh"
kill $PID
"$PYTHON_BINARY" "$SOCKS5_SERVER_SCRIPT" --port 1081 --map "127.0.0.1:12345 to $FIRST_HOST" &
SOCKS5_PROXY_PID=$!
if [[ $TEST_SOCKS5_CSFLE == "true" ]]; then
[ "$SSL" == "nossl" ] && [[ "$OSTYPE" == "linux-gnu"* ]] && \
env MONGODB_URI='mongodb://127.0.0.1:12345/?proxyHost=127.0.0.1&proxyPort=1081' \
bash "${PROJECT_DIRECTORY}/.evergreen/run-custom-csfle-tests.sh"
else
env SOCKS5_CONFIG='["127.0.0.1",1081]' npm run check:socks5
fi
kill $SOCKS5_PROXY_PID

# TODO: It might be worth using something more robust to control
# the Socks5 proxy server script's lifetime