Skip to content

Commit 425dbe0

Browse files
authored
fix(NODE-4998): use ipv4 in socks5 tests for node 18 (#3538)
1 parent f7961a7 commit 425dbe0

File tree

4 files changed

+64
-15
lines changed

4 files changed

+64
-15
lines changed

.evergreen/config.in.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,7 @@ functions:
434434
export DRIVERS_TOOLS="${DRIVERS_TOOLS}"
435435
export NODE_LTS_NAME='${NODE_LTS_NAME}'
436436
export MONGODB_URI="${MONGODB_URI}"
437+
export TEST_SOCKS5_CSFLE="${TEST_SOCKS5_CSFLE}"
437438
export SSL="${SSL}"
438439
439440
# Disable xtrace (just in case it was accidentally set).

.evergreen/config.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,8 @@ functions:
398398
399399
export MONGODB_URI="${MONGODB_URI}"
400400
401+
export TEST_SOCKS5_CSFLE="${TEST_SOCKS5_CSFLE}"
402+
401403
export SSL="${SSL}"
402404
403405
@@ -1303,6 +1305,18 @@ tasks:
13031305
TOPOLOGY: replica_set
13041306
- func: bootstrap kms servers
13051307
- func: run socks5 tests
1308+
- name: test-socks5-csfle
1309+
tags: []
1310+
commands:
1311+
- func: install dependencies
1312+
- func: bootstrap mongo-orchestration
1313+
vars:
1314+
VERSION: latest
1315+
TOPOLOGY: replica_set
1316+
- func: bootstrap kms servers
1317+
- func: run socks5 tests
1318+
vars:
1319+
TEST_SOCKS5_CSFLE: 'true'
13061320
- name: test-socks5-tls
13071321
tags: []
13081322
commands:
@@ -2661,6 +2675,7 @@ buildvariants:
26612675
- test-auth-kerberos
26622676
- test-auth-ldap
26632677
- test-socks5
2678+
- test-socks5-csfle
26642679
- test-socks5-tls
26652680
- test-zstd-compression
26662681
- test-snappy-compression
@@ -2709,6 +2724,7 @@ buildvariants:
27092724
- test-auth-kerberos
27102725
- test-auth-ldap
27112726
- test-socks5
2727+
- test-socks5-csfle
27122728
- test-socks5-tls
27132729
- test-tls-support-latest
27142730
- test-tls-support-6.0
@@ -2754,6 +2770,7 @@ buildvariants:
27542770
- test-latest-load-balanced
27552771
- test-auth-ldap
27562772
- test-socks5
2773+
- test-socks5-csfle
27572774
- test-socks5-tls
27582775
- test-tls-support-latest
27592776
- test-tls-support-6.0
@@ -2798,6 +2815,7 @@ buildvariants:
27982815
- test-6.0-load-balanced
27992816
- test-latest-load-balanced
28002817
- test-auth-ldap
2818+
- test-socks5-csfle
28012819
- test-socks5-tls
28022820
- test-tls-support-latest
28032821
- test-tls-support-6.0
@@ -2838,6 +2856,7 @@ buildvariants:
28382856
- test-latest-server-v1-api
28392857
- test-atlas-data-lake
28402858
- test-socks5
2859+
- test-socks5-csfle
28412860
- test-socks5-tls
28422861
- test-zstd-compression
28432862
- test-snappy-compression
@@ -2880,6 +2899,7 @@ buildvariants:
28802899
- test-latest-server-v1-api
28812900
- test-atlas-data-lake
28822901
- test-socks5
2902+
- test-socks5-csfle
28832903
- test-socks5-tls
28842904
- test-tls-support-latest
28852905
- test-tls-support-6.0
@@ -2920,6 +2940,7 @@ buildvariants:
29202940
- test-latest-server-v1-api
29212941
- test-atlas-data-lake
29222942
- test-socks5
2943+
- test-socks5-csfle
29232944
- test-socks5-tls
29242945
- test-tls-support-latest
29252946
- test-tls-support-6.0

.evergreen/generate_evergreen_tasks.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,27 @@ TASKS.push(
204204
{ func: 'run socks5 tests' }
205205
]
206206
},
207+
{
208+
name: 'test-socks5-csfle',
209+
tags: [],
210+
commands: [
211+
{ func: 'install dependencies' },
212+
{
213+
func: 'bootstrap mongo-orchestration',
214+
vars: {
215+
VERSION: 'latest',
216+
TOPOLOGY: 'replica_set'
217+
}
218+
},
219+
{ func: 'bootstrap kms servers' },
220+
{
221+
func: 'run socks5 tests',
222+
vars: {
223+
TEST_SOCKS5_CSFLE: 'true'
224+
}
225+
}
226+
]
227+
},
207228
{
208229
name: 'test-socks5-tls',
209230
tags: [],

.evergreen/run-socks5-tests.sh

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ fi
1818

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

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

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

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

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

0 commit comments

Comments
 (0)