Skip to content

Commit 399f357

Browse files
Serverless + socks5 tests should be fixed.
1 parent 9e9eae1 commit 399f357

File tree

4 files changed

+88
-97
lines changed

4 files changed

+88
-97
lines changed

.evergreen/config.in.yml

Lines changed: 8 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -191,39 +191,14 @@ functions:
191191
type: test
192192
params:
193193
timeout_secs: 300
194-
shell: bash
195-
script: |
196-
${PREPARE_SHELL}
197-
198-
# Disable xtrace (just in case it was accidentally set).
199-
set +x
200-
source ./prepare_client_encryption.sh
201-
rm -f ./prepare_client_encryption.sh
202-
203-
export VERSION=${VERSION}
204-
export DRIVERS_TOOLS=${DRIVERS_TOOLS}
205-
206-
source ${PROJECT_DIRECTORY}/.evergreen/prepare-crypt-shared-lib.sh
207-
208-
echo "CRYPT_SHARED_LIB_PATH: $CRYPT_SHARED_LIB_PATH"
209-
210-
# Get access to the AWS temporary credentials:
211-
echo "adding temporary AWS credentials to environment"
212-
# CSFLE_AWS_TEMP_ACCESS_KEY_ID, CSFLE_AWS_TEMP_SECRET_ACCESS_KEY, CSFLE_AWS_TEMP_SESSION_TOKEN
213-
pushd "$DRIVERS_TOOLS"/.evergreen/csfle
214-
. ./activate-kmstlsvenv.sh
215-
. ./set-temp-creds.sh
216-
popd
217-
218-
export MONGODB_API_VERSION="${MONGODB_API_VERSION}"
219-
export AUTH="auth"
220-
export SSL="ssl"
221-
export TEST_CSFLE=true
222-
223-
source secrets-export.sh
224-
source serverless.env
225-
226-
bash ${PROJECT_DIRECTORY}/.evergreen/run-serverless-tests.sh
194+
working_dir: src
195+
binary: bash
196+
env:
197+
AUTH: 'auth'
198+
SSL: 'ssl'
199+
add_expansions_to_env: true
200+
args:
201+
- .evergreen/run-serverless-tests.sh
227202

228203
"start-load-balancer":
229204
- command: shell.exec

.evergreen/config.yml

Lines changed: 36 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -162,39 +162,14 @@ functions:
162162
type: test
163163
params:
164164
timeout_secs: 300
165-
shell: bash
166-
script: |
167-
${PREPARE_SHELL}
168-
169-
# Disable xtrace (just in case it was accidentally set).
170-
set +x
171-
source ./prepare_client_encryption.sh
172-
rm -f ./prepare_client_encryption.sh
173-
174-
export VERSION=${VERSION}
175-
export DRIVERS_TOOLS=${DRIVERS_TOOLS}
176-
177-
source ${PROJECT_DIRECTORY}/.evergreen/prepare-crypt-shared-lib.sh
178-
179-
echo "CRYPT_SHARED_LIB_PATH: $CRYPT_SHARED_LIB_PATH"
180-
181-
# Get access to the AWS temporary credentials:
182-
echo "adding temporary AWS credentials to environment"
183-
# CSFLE_AWS_TEMP_ACCESS_KEY_ID, CSFLE_AWS_TEMP_SECRET_ACCESS_KEY, CSFLE_AWS_TEMP_SESSION_TOKEN
184-
pushd "$DRIVERS_TOOLS"/.evergreen/csfle
185-
. ./activate-kmstlsvenv.sh
186-
. ./set-temp-creds.sh
187-
popd
188-
189-
export MONGODB_API_VERSION="${MONGODB_API_VERSION}"
190-
export AUTH="auth"
191-
export SSL="ssl"
192-
export TEST_CSFLE=true
193-
194-
source secrets-export.sh
195-
source serverless.env
196-
197-
bash ${PROJECT_DIRECTORY}/.evergreen/run-serverless-tests.sh
165+
working_dir: src
166+
binary: bash
167+
env:
168+
AUTH: auth
169+
SSL: ssl
170+
add_expansions_to_env: true
171+
args:
172+
- .evergreen/run-serverless-tests.sh
198173
start-load-balancer:
199174
- command: shell.exec
200175
params:
@@ -1894,7 +1869,7 @@ tasks:
18941869
- func: bootstrap mongo-orchestration
18951870
- func: bootstrap kms servers
18961871
- func: run socks5 tests
1897-
- name: test-socks5-csfle
1872+
- name: test-socks5-csfle-auth
18981873
tags:
18991874
- socks5-csfle
19001875
commands:
@@ -1905,6 +1880,23 @@ tasks:
19051880
- {key: VERSION, value: latest}
19061881
- {key: TOPOLOGY, value: replica_set}
19071882
- {key: TEST_SOCKS5_CSFLE, value: 'true'}
1883+
- {key: AUTH, value: auth}
1884+
- func: install dependencies
1885+
- func: bootstrap mongo-orchestration
1886+
- func: bootstrap kms servers
1887+
- func: run socks5 tests
1888+
- name: test-socks5-csfle-noauth
1889+
tags:
1890+
- socks5-csfle
1891+
commands:
1892+
- command: expansions.update
1893+
type: setup
1894+
params:
1895+
updates:
1896+
- {key: VERSION, value: latest}
1897+
- {key: TOPOLOGY, value: replica_set}
1898+
- {key: TEST_SOCKS5_CSFLE, value: 'true'}
1899+
- {key: AUTH, value: noauth}
19081900
- func: install dependencies
19091901
- func: bootstrap mongo-orchestration
19101902
- func: bootstrap kms servers
@@ -4670,7 +4662,8 @@ buildvariants:
46704662
- test-auth-kerberos
46714663
- test-auth-ldap
46724664
- test-socks5
4673-
- test-socks5-csfle
4665+
- test-socks5-csfle-auth
4666+
- test-socks5-csfle-noauth
46744667
- test-socks5-tls
46754668
- test-snappy-compression
46764669
- test-zstd-1.x-compression
@@ -4729,7 +4722,8 @@ buildvariants:
47294722
- test-auth-kerberos
47304723
- test-auth-ldap
47314724
- test-socks5
4732-
- test-socks5-csfle
4725+
- test-socks5-csfle-auth
4726+
- test-socks5-csfle-noauth
47334727
- test-socks5-tls
47344728
- test-snappy-compression
47354729
- test-zstd-1.x-compression
@@ -4788,7 +4782,8 @@ buildvariants:
47884782
- test-auth-kerberos
47894783
- test-auth-ldap
47904784
- test-socks5
4791-
- test-socks5-csfle
4785+
- test-socks5-csfle-auth
4786+
- test-socks5-csfle-noauth
47924787
- test-socks5-tls
47934788
- test-snappy-compression
47944789
- test-zstd-1.x-compression
@@ -4847,7 +4842,8 @@ buildvariants:
48474842
- test-auth-kerberos
48484843
- test-auth-ldap
48494844
- test-socks5
4850-
- test-socks5-csfle
4845+
- test-socks5-csfle-auth
4846+
- test-socks5-csfle-noauth
48514847
- test-socks5-tls
48524848
- test-snappy-compression
48534849
- test-zstd-1.x-compression
@@ -4904,7 +4900,8 @@ buildvariants:
49044900
- test-latest-load-balanced
49054901
- test-auth-kerberos
49064902
- test-auth-ldap
4907-
- test-socks5-csfle
4903+
- test-socks5-csfle-auth
4904+
- test-socks5-csfle-noauth
49084905
- test-socks5-tls
49094906
- test-snappy-compression
49104907
- test-zstd-1.x-compression

.evergreen/generate_evergreen_tasks.js

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,13 +180,30 @@ TASKS.push(
180180
]
181181
},
182182
{
183-
name: 'test-socks5-csfle',
183+
name: 'test-socks5-csfle-auth',
184184
tags: ['socks5-csfle'],
185185
commands: [
186186
updateExpansions({
187187
VERSION: 'latest',
188188
TOPOLOGY: 'replica_set',
189-
TEST_SOCKS5_CSFLE: 'true'
189+
TEST_SOCKS5_CSFLE: 'true',
190+
AUTH: 'auth'
191+
}),
192+
{ func: 'install dependencies' },
193+
{ func: 'bootstrap mongo-orchestration' },
194+
{ func: 'bootstrap kms servers' },
195+
{ func: 'run socks5 tests' }
196+
]
197+
},
198+
{
199+
name: 'test-socks5-csfle-noauth',
200+
tags: ['socks5-csfle'],
201+
commands: [
202+
updateExpansions({
203+
VERSION: 'latest',
204+
TOPOLOGY: 'replica_set',
205+
TEST_SOCKS5_CSFLE: 'true',
206+
AUTH: 'noauth'
190207
}),
191208
{ func: 'install dependencies' },
192209
{ func: 'bootstrap mongo-orchestration' },

.evergreen/run-socks5-tests.sh

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -39,31 +39,33 @@ if [ "Windows_NT" = "$OS" ]; then
3939
SOCKS5_SERVER_SCRIPT=$(cygpath -w "$SOCKS5_SERVER_SCRIPT")
4040
fi
4141

42-
# First, test with Socks5 + authentication required
43-
"$PYTHON_BINARY" "$SOCKS5_SERVER_SCRIPT" --port 1080 --auth username:p4ssw0rd --map "127.0.0.1:12345 to $FIRST_HOST" &
44-
SOCKS5_PROXY_PID=$!
45-
if [[ $TEST_SOCKS5_CSFLE == "true" ]]; then
46-
setup_fle
47-
[ "$SSL" == "nossl" ] && [[ "$OSTYPE" == "linux-gnu"* ]] && \
48-
env MONGODB_URI='mongodb://127.0.0.1:12345/?proxyHost=127.0.0.1&proxyUsername=username&proxyPassword=p4ssw0rd' \
49-
npm run check:csfle
50-
else
51-
env SOCKS5_CONFIG='["127.0.0.1",1080,"username","p4ssw0rd"]' npm run check:socks5
52-
fi
53-
kill $SOCKS5_PROXY_PID
54-
55-
# Second, test with Socks5 + no authentication
56-
"$PYTHON_BINARY" "$SOCKS5_SERVER_SCRIPT" --port 1081 --map "127.0.0.1:12345 to $FIRST_HOST" &
57-
SOCKS5_PROXY_PID=$!
58-
if [[ $TEST_SOCKS5_CSFLE == "true" ]]; then
59-
setup_fle
60-
[ "$SSL" == "nossl" ] && [[ "$OSTYPE" == "linux-gnu"* ]] && \
61-
env MONGODB_URI='mongodb://127.0.0.1:12345/?proxyHost=127.0.0.1&proxyPort=1081' \
42+
if [ "$AUTH" = "auth" ]; then
43+
# First, test with Socks5 + authentication required
44+
"$PYTHON_BINARY" "$SOCKS5_SERVER_SCRIPT" --port 1080 --auth username:p4ssw0rd --map "127.0.0.1:12345 to $FIRST_HOST" &
45+
SOCKS5_PROXY_PID=$!
46+
if [[ $TEST_SOCKS5_CSFLE == "true" ]]; then
47+
setup_fle
48+
[ "$SSL" == "nossl" ] && [[ "$OSTYPE" == "linux-gnu"* ]] && \
49+
env MONGODB_URI='mongodb://127.0.0.1:12345/?proxyHost=127.0.0.1&proxyUsername=username&proxyPassword=p4ssw0rd' \
6250
npm run check:csfle
63-
else
64-
env SOCKS5_CONFIG='["127.0.0.1",1081]' npm run check:socks5
51+
else
52+
env SOCKS5_CONFIG='["127.0.0.1",1080,"username","p4ssw0rd"]' npm run check:socks5
53+
fi
54+
kill $SOCKS5_PROXY_PID
55+
else
56+
# Second, test with Socks5 + no authentication
57+
"$PYTHON_BINARY" "$SOCKS5_SERVER_SCRIPT" --port 1081 --map "127.0.0.1:12345 to $FIRST_HOST" &
58+
SOCKS5_PROXY_PID=$!
59+
if [[ $TEST_SOCKS5_CSFLE == "true" ]]; then
60+
setup_fle
61+
[ "$SSL" == "nossl" ] && [[ "$OSTYPE" == "linux-gnu"* ]] && \
62+
env MONGODB_URI='mongodb://127.0.0.1:12345/?proxyHost=127.0.0.1&proxyPort=1081' \
63+
npm run check:csfle
64+
else
65+
env SOCKS5_CONFIG='["127.0.0.1",1081]' npm run check:socks5
66+
fi
67+
kill $SOCKS5_PROXY_PID
6568
fi
66-
kill $SOCKS5_PROXY_PID
6769

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

0 commit comments

Comments
 (0)