Skip to content

Commit 12a1530

Browse files
committed
add task
1 parent 02a60a5 commit 12a1530

File tree

3 files changed

+70
-11
lines changed

3 files changed

+70
-11
lines changed

.evergreen/config.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,42 @@ functions:
553553
KMS_MOCK_SERVERS_RUNNING: "true"
554554
args: [*task-runner, evg-test-kmip]
555555

556+
start-kms-failpoint-server:
557+
- command: ec2.assume_role
558+
params:
559+
role_arn: ${aws_test_secrets_role}
560+
- command: subprocess.exec
561+
params:
562+
working_dir: src/go.mongodb.org/mongo-driver
563+
binary: bash
564+
background: true
565+
include_expansions_in_env: ["AWS_ACCESS_KEY_ID", "AWS_SECRET_ACCESS_KEY", "AWS_SESSION_TOKEN", "DRIVERS_TOOLS"]
566+
# This cannot use task because it will hang on Windows.
567+
args: [etc/setup-encryption.sh]
568+
- command: subprocess.exec
569+
params:
570+
binary: python3
571+
background: true
572+
args: ["-u", "${DRIVERS_TOOLS}/.evergreen/csfle/kms_failpoint_server.py", "--port", "9003"]
573+
574+
run-retry-kms-requests:
575+
- command: subprocess.exec
576+
type: test
577+
params:
578+
binary: "bash"
579+
env:
580+
GO_BUILD_TAGS: cse
581+
include_expansions_in_env: [AUTH, SSL, MONGODB_URI, TOPOLOGY,
582+
MONGO_GO_DRIVER_COMPRESSOR]
583+
args: [*task-runner, setup-test]
584+
- command: subprocess.exec
585+
type: test
586+
params:
587+
binary: "bash"
588+
env:
589+
KMS_FAILPOINT_SERVERS_RUNNING: "true"
590+
args: [*task-runner, evg-test-retry-kms-requests]
591+
556592
run-fuzz-tests:
557593
- command: subprocess.exec
558594
type: test
@@ -1486,6 +1522,21 @@ tasks:
14861522
AUTH: "noauth"
14871523
SSL: "nossl"
14881524

1525+
- name: "test-retry-kms-requests"
1526+
tags: ["retry-kms-requests"]
1527+
commands:
1528+
- func: bootstrap-mongo-orchestration
1529+
vars:
1530+
TOPOLOGY: "server"
1531+
AUTH: "noauth"
1532+
SSL: "nossl"
1533+
- func: start-kms-failpoint-server
1534+
- func: run-retry-kms-requests
1535+
vars:
1536+
TOPOLOGY: "server"
1537+
AUTH: "noauth"
1538+
SSL: "nossl"
1539+
14891540
- name: "test-serverless"
14901541
tags: ["serverless"]
14911542
commands:
@@ -2195,6 +2246,12 @@ buildvariants:
21952246
tasks:
21962247
- name: ".kms-kmip"
21972248

2249+
- matrix_name: "retry-kms-requests-test"
2250+
matrix_spec: { version: ["7.0"], os-ssl-40: ["rhel87-64"] }
2251+
display_name: "Retry KMS Requests ${os-ssl-40}"
2252+
tasks:
2253+
- name: ".retry-kms-requests"
2254+
21982255
- matrix_name: "fuzz-test"
21992256
matrix_spec: { version: ["5.0"], os-ssl-40: ["rhel87-64"] }
22002257
display_name: "Fuzz ${version} ${os-ssl-40}"

Taskfile.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,9 @@ tasks:
141141
evg-test-kms:
142142
- go test -exec "env PKG_CONFIG_PATH=${PKG_CONFIG_PATH} LD_LIBRARY_PATH=${LD_LIBRARY_PATH}" ${BUILD_TAGS} -v -timeout {{.TEST_TIMEOUT}}s ./internal/integration -run TestClientSideEncryptionProse/kms_tls_tests >> test.suite
143143

144+
evg-test-retry-kms-requests:
145+
- go test -exec "env PKG_CONFIG_PATH=${PKG_CONFIG_PATH} LD_LIBRARY_PATH=${LD_LIBRARY_PATH}" ${BUILD_TAGS} -v -timeout {{.TEST_TIMEOUT}}s ./internal/integration -run TestClientSideEncryptionProse/kms_retry_tests >> test.suite
146+
144147
evg-test-load-balancers:
145148
# Load balancer should be tested with all unified tests as well as tests in the following
146149
# components: retryable reads, retryable writes, change streams, initial DNS seedlist discovery.

internal/integration/client_side_encryption_prose_test.go

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313
"bytes"
1414
"context"
1515
"crypto/tls"
16-
"crypto/x509"
1716
"encoding/base64"
1817
"encoding/json"
1918
"fmt"
@@ -2983,7 +2982,12 @@ func TestClientSideEncryptionProse(t *testing.T) {
29832982
})
29842983
})
29852984

2986-
mt.RunOpts("24. KMS Retry Tests", qeRunOpts22, func(mt *mtest.T) {
2985+
mt.RunOpts("24. kms retry tests", noClientOpts, func(mt *mtest.T) {
2986+
kmsTlsTestcase := os.Getenv("KMS_FAILPOINT_SERVERS_RUNNING")
2987+
if kmsTlsTestcase == "" {
2988+
mt.Skipf("Skipping test as KMS_FAILPOINT_SERVERS_RUNNING is not set")
2989+
}
2990+
29872991
setFailPoint := func(failure string, count int) error {
29882992
url := fmt.Sprintf("https://localhost:9003/set_failpoint/%s", failure)
29892993
var payloadBuf bytes.Buffer
@@ -2994,18 +2998,10 @@ func TestClientSideEncryptionProse(t *testing.T) {
29942998
return err
29952999
}
29963000

2997-
cert, err := ioutil.ReadFile(os.Getenv("CSFLE_TLS_CA_FILE"))
2998-
if err != nil {
2999-
return err
3000-
}
3001-
3002-
certPool := x509.NewCertPool()
3003-
certPool.AppendCertsFromPEM(cert)
3004-
30053001
client := &http.Client{
30063002
Transport: &http.Transport{
30073003
TLSClientConfig: &tls.Config{
3008-
RootCAs: certPool,
3004+
InsecureSkipVerify: true,
30093005
},
30103006
},
30113007
}
@@ -3036,6 +3032,9 @@ func TestClientSideEncryptionProse(t *testing.T) {
30363032
keyID, err = clientEncryption.CreateDataKey(context.Background(), "aws", dkOpts)
30373033
require.NoError(mt, err, "error in CreateDataKey: %v", err)
30383034

3035+
err = setFailPoint("http", 1)
3036+
require.NoError(mt, err, "mock server error: %v", err)
3037+
30393038
testVal := bson.RawValue{Type: bson.TypeInt32, Value: bsoncore.AppendInt32(nil, 123)}
30403039
eo := options.Encrypt().
30413040
SetKeyID(keyID).

0 commit comments

Comments
 (0)