Skip to content

Commit 623d659

Browse files
authored
Update mock KMS server ports to avoid load balancer test conflicts (#1099)
1 parent 7021586 commit 623d659

File tree

5 files changed

+35
-36
lines changed

5 files changed

+35
-36
lines changed

.evergreen/config.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -783,10 +783,10 @@ functions:
783783
echo "Starting mock KMS servers..."
784784
cd ./drivers-evergreen-tools/.evergreen/csfle
785785
. ./activate_venv.sh
786-
python -u kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/server.pem --port 7999 &
787-
python -u kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/expired.pem --port 8000 &
788-
python -u kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/wrong-host.pem --port 8001 &
789-
python -u kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/server.pem --port 8002 --require_client_cert &
786+
python -u kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/server.pem --port 8999 &
787+
python -u kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/expired.pem --port 9000 &
788+
python -u kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/wrong-host.pem --port 9001 &
789+
python -u kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/server.pem --require_client_cert --port 9002 &
790790
python -u kms_kmip_server.py &
791791
echo "Starting mock KMS servers... done."
792792
start load balancer:

.evergreen/run-tests.sh

+4-5
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,10 @@ if [ "$CLIENT_SIDE_ENCRYPTION" = "on" ]; then
104104
echo "Could not detect mock KMS server on port $1"
105105
return 1
106106
}
107-
wait_for_kms_server 7999
108-
wait_for_kms_server 8000
109-
wait_for_kms_server 8001
110-
wait_for_kms_server 8002
107+
wait_for_kms_server 8999
108+
wait_for_kms_server 9000
109+
wait_for_kms_server 9001
110+
wait_for_kms_server 9002
111111
wait_for_kms_server 5698
112112
echo "Waiting for mock KMS servers to start... done."
113113
if ! test -d /cygdrive/c; then
@@ -164,4 +164,3 @@ case "$OS" in
164164

165165
;;
166166
esac
167-

CONTRIBUTING.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -263,10 +263,10 @@ The set of mock KMS servers running in the background and their corresponding in
263263

264264
| Port | CA File | Cert File | Command |
265265
| --- | --- | --- | --- |
266-
| 7999 | ca.pem | server.pem | python -u kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/server.pem --port 7999
267-
| 8000 | ca.pem | expired.pem | python -u kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/expired.pem --port 8000
268-
| 8001 | ca.pem | wrong-host.pem | python -u kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/wrong-host.pem --port 8001
269-
| 8002 | ca.pem | server.pem | python -u kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/server.pem --port 8002 --require_client_cert
266+
| 8999 | ca.pem | server.pem | python -u kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/server.pem --port 8999
267+
| 9000 | ca.pem | expired.pem | python -u kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/expired.pem --port 9000
268+
| 9001 | ca.pem | wrong-host.pem | python -u kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/wrong-host.pem --port 9001
269+
| 9002 | ca.pem | server.pem | python -u kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/server.pem --port --require_client_cert 9002
270270
| 5698 | ca.pem | server.pem | python -u kms_kmip_server.py
271271

272272
The path to `ca.pem` and `client.pem` must be passed through the following environment variables:

build/evergreen_config_lib/functions.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -567,10 +567,10 @@
567567
echo "Starting mock KMS servers..."
568568
cd ./drivers-evergreen-tools/.evergreen/csfle
569569
. ./activate_venv.sh
570-
python -u kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/server.pem --port 7999 &
571-
python -u kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/expired.pem --port 8000 &
572-
python -u kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/wrong-host.pem --port 8001 &
573-
python -u kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/server.pem --port 8002 --require_client_cert &
570+
python -u kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/server.pem --port 8999 &
571+
python -u kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/expired.pem --port 9000 &
572+
python -u kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/wrong-host.pem --port 9001 &
573+
python -u kms_http_server.py --ca_file ../x509gen/ca.pem --cert_file ../x509gen/server.pem --require_client_cert --port 9002 &
574574
python -u kms_kmip_server.py &
575575
echo "Starting mock KMS servers... done."
576576
''', test=False, background=True),

src/libmongoc/tests/test-mongoc-client-side-encryption.c

+19-19
Original file line numberDiff line numberDiff line change
@@ -2823,13 +2823,13 @@ test_kms_tls_cert_valid (void *unused)
28232823

28242824
#if defined(MONGOC_ENABLE_SSL_SECURE_CHANNEL)
28252825
/* Certificate verification fails with Secure Channel given
2826-
* "127.0.0.1:7999" with error: "hostname doesn't match certificate". */
2826+
* "127.0.0.1:8999" with error: "hostname doesn't match certificate". */
28272827
ASSERT_OR_PRINT (
2828-
_mongoc_host_list_from_string_with_err (&host, "localhost:7999", &error),
2828+
_mongoc_host_list_from_string_with_err (&host, "localhost:8999", &error),
28292829
error);
28302830
#else
28312831
ASSERT_OR_PRINT (
2832-
_mongoc_host_list_from_string_with_err (&host, "127.0.0.1:7999", &error),
2832+
_mongoc_host_list_from_string_with_err (&host, "127.0.0.1:8999", &error),
28332833
error);
28342834
#endif
28352835

@@ -2878,7 +2878,7 @@ test_kms_tls_cert_expired (void *unused)
28782878
tmp_bson ("{ 'region': 'us-east-1', 'key': "
28792879
"'arn:aws:kms:us-east-1:579766882180:key/"
28802880
"89fcc2c4-08b0-4bd9-9f25-e30687b580d0', "
2881-
"'endpoint': '127.0.0.1:8000' }"));
2881+
"'endpoint': '127.0.0.1:9000' }"));
28822882

28832883
ret = mongoc_client_encryption_create_datakey (
28842884
client_encryption, "aws", opts, &keyid, &error);
@@ -2926,7 +2926,7 @@ test_kms_tls_cert_wrong_host (void *unused)
29262926
tmp_bson ("{ 'region': 'us-east-1', 'key': "
29272927
"'arn:aws:kms:us-east-1:579766882180:key/"
29282928
"89fcc2c4-08b0-4bd9-9f25-e30687b580d0', "
2929-
"'endpoint': '127.0.0.1:8001' }"));
2929+
"'endpoint': '127.0.0.1:9001' }"));
29302930

29312931
ret = mongoc_client_encryption_create_datakey (
29322932
client_encryption, "aws", opts, &keyid, &error);
@@ -2997,7 +2997,7 @@ _tls_test_make_client_encryption (mongoc_client_t *keyvault_client,
29972997
bson_concat (kms_providers,
29982998
tmp_bson ("{'azure': {'tenantId': '%s', 'clientId': '%s', "
29992999
"'clientSecret': '%s', "
3000-
"'identityPlatformEndpoint': '127.0.0.1:8002' }}",
3000+
"'identityPlatformEndpoint': '127.0.0.1:9002' }}",
30013001
mongoc_test_azure_tenant_id,
30023002
mongoc_test_azure_client_id,
30033003
mongoc_test_azure_client_secret));
@@ -3010,7 +3010,7 @@ _tls_test_make_client_encryption (mongoc_client_t *keyvault_client,
30103010

30113011
bson_concat (kms_providers,
30123012
tmp_bson ("{'gcp': { 'email': '%s', 'privateKey': '%s', "
3013-
"'endpoint': '127.0.0.1:8002' }}",
3013+
"'endpoint': '127.0.0.1:9002' }}",
30143014
mongoc_test_gcp_email,
30153015
mongoc_test_gcp_privatekey));
30163016
bson_concat (
@@ -3036,13 +3036,13 @@ _tls_test_make_client_encryption (mongoc_client_t *keyvault_client,
30363036
bson_concat (kms_providers,
30373037
tmp_bson ("{'azure': {'tenantId': '%s', 'clientId': '%s', "
30383038
"'clientSecret': '%s', "
3039-
"'identityPlatformEndpoint': '127.0.0.1:8002'}}",
3039+
"'identityPlatformEndpoint': '127.0.0.1:9002'}}",
30403040
mongoc_test_azure_tenant_id,
30413041
mongoc_test_azure_client_id,
30423042
mongoc_test_azure_client_secret));
30433043
bson_concat (kms_providers,
30443044
tmp_bson ("{'gcp': { 'email': '%s', 'privateKey': '%s', "
3045-
"'endpoint': '127.0.0.1:8002'}}",
3045+
"'endpoint': '127.0.0.1:9002'}}",
30463046
mongoc_test_gcp_email,
30473047
mongoc_test_gcp_privatekey));
30483048
bson_concat (kms_providers,
@@ -3057,7 +3057,7 @@ _tls_test_make_client_encryption (mongoc_client_t *keyvault_client,
30573057
bson_concat (kms_providers,
30583058
tmp_bson ("{'azure': {'tenantId': '%s', 'clientId': '%s', "
30593059
"'clientSecret': '%s', "
3060-
"'identityPlatformEndpoint': '127.0.0.1:8000'}}",
3060+
"'identityPlatformEndpoint': '127.0.0.1:9000'}}",
30613061
mongoc_test_azure_tenant_id,
30623062
mongoc_test_azure_client_id,
30633063
mongoc_test_azure_client_secret));
@@ -3066,14 +3066,14 @@ _tls_test_make_client_encryption (mongoc_client_t *keyvault_client,
30663066

30673067
bson_concat (kms_providers,
30683068
tmp_bson ("{'gcp': { 'email': '%s', 'privateKey': '%s', "
3069-
"'endpoint': '127.0.0.1:8000'}}",
3069+
"'endpoint': '127.0.0.1:9000'}}",
30703070
mongoc_test_gcp_email,
30713071
mongoc_test_gcp_privatekey));
30723072
bson_concat (tls_opts,
30733073
tmp_bson ("{'gcp': {'tlsCaFile': '%s'} }", ca_file));
30743074

30753075
bson_concat (kms_providers,
3076-
tmp_bson ("{'kmip': { 'endpoint': '127.0.0.1:8000' }}"));
3076+
tmp_bson ("{'kmip': { 'endpoint': '127.0.0.1:9000' }}"));
30773077
bson_concat (tls_opts,
30783078
tmp_bson ("{'kmip': {'tlsCaFile': '%s'} }", ca_file));
30793079
} else if (test_ce == INVALID_HOSTNAME) {
@@ -3086,7 +3086,7 @@ _tls_test_make_client_encryption (mongoc_client_t *keyvault_client,
30863086
bson_concat (kms_providers,
30873087
tmp_bson ("{'azure': {'tenantId': '%s', 'clientId': '%s', "
30883088
"'clientSecret': '%s', "
3089-
"'identityPlatformEndpoint': '127.0.0.1:8001' }}",
3089+
"'identityPlatformEndpoint': '127.0.0.1:9001' }}",
30903090
mongoc_test_azure_tenant_id,
30913091
mongoc_test_azure_client_id,
30923092
mongoc_test_azure_client_secret));
@@ -3095,14 +3095,14 @@ _tls_test_make_client_encryption (mongoc_client_t *keyvault_client,
30953095

30963096
bson_concat (kms_providers,
30973097
tmp_bson ("{'gcp': { 'email': '%s', 'privateKey': '%s', "
3098-
"'endpoint': '127.0.0.1:8001' }}",
3098+
"'endpoint': '127.0.0.1:9001' }}",
30993099
mongoc_test_gcp_email,
31003100
mongoc_test_gcp_privatekey));
31013101
bson_concat (tls_opts,
31023102
tmp_bson ("{'gcp': {'tlsCaFile': '%s'} }", ca_file));
31033103

31043104
bson_concat (kms_providers,
3105-
tmp_bson ("{'kmip': { 'endpoint': '127.0.0.1:8001' }}"));
3105+
tmp_bson ("{'kmip': { 'endpoint': '127.0.0.1:9001' }}"));
31063106
bson_concat (tls_opts,
31073107
tmp_bson ("{'kmip': {'tlsCaFile': '%s'} }", ca_file));
31083108
} else {
@@ -3205,7 +3205,7 @@ test_kms_tls_options (void *unused)
32053205
tmp_bson ("{ 'region': 'us-east-1', 'key': "
32063206
"'arn:aws:kms:us-east-1:579766882180:key/"
32073207
"89fcc2c4-08b0-4bd9-9f25-e30687b580d0', 'endpoint': "
3208-
"'127.0.0.1:8002' }"));
3208+
"'127.0.0.1:9002' }"));
32093209
res = mongoc_client_encryption_create_datakey (
32103210
client_encryption_no_client_cert, "aws", dkopts, &keyid, &error);
32113211
ASSERT_ERROR_CONTAINS (
@@ -3221,7 +3221,7 @@ test_kms_tls_options (void *unused)
32213221
tmp_bson ("{ 'region': 'us-east-1', 'key': "
32223222
"'arn:aws:kms:us-east-1:579766882180:key/"
32233223
"89fcc2c4-08b0-4bd9-9f25-e30687b580d0', 'endpoint': "
3224-
"'127.0.0.1:8002' }"));
3224+
"'127.0.0.1:9002' }"));
32253225
res = mongoc_client_encryption_create_datakey (
32263226
client_encryption_with_tls, "aws", dkopts, &keyid, &error);
32273227
ASSERT_ERROR_CONTAINS (error,
@@ -3239,7 +3239,7 @@ test_kms_tls_options (void *unused)
32393239
tmp_bson ("{ 'region': 'us-east-1', 'key': "
32403240
"'arn:aws:kms:us-east-1:579766882180:key/"
32413241
"89fcc2c4-08b0-4bd9-9f25-e30687b580d0', 'endpoint': "
3242-
"'127.0.0.1:8000' }"));
3242+
"'127.0.0.1:9000' }"));
32433243
res = mongoc_client_encryption_create_datakey (
32443244
client_encryption_expired, "aws", dkopts, &keyid, &error);
32453245
ASSERT_EXPIRED (error);
@@ -3254,7 +3254,7 @@ test_kms_tls_options (void *unused)
32543254
tmp_bson ("{ 'region': 'us-east-1', 'key': "
32553255
"'arn:aws:kms:us-east-1:579766882180:key/"
32563256
"89fcc2c4-08b0-4bd9-9f25-e30687b580d0', 'endpoint': "
3257-
"'127.0.0.1:8001' }"));
3257+
"'127.0.0.1:9001' }"));
32583258
res = mongoc_client_encryption_create_datakey (
32593259
client_encryption_invalid_hostname, "aws", dkopts, &keyid, &error);
32603260
ASSERT_INVALID_HOSTNAME (error);

0 commit comments

Comments
 (0)