Skip to content

Commit

Permalink
add env variable check
Browse files Browse the repository at this point in the history
  • Loading branch information
gabbyasuncion committed Nov 23, 2021
1 parent 14aa270 commit 0c1a981
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .evergreen/config.yml
Expand Up @@ -903,6 +903,7 @@ functions:
working_dir: src/go.mongodb.org/mongo-driver
script: |
${PREPARE_SHELL}
export KMS_MOCK_SERVERS_RUNNING="${KMS_MOCK_SERVERS_RUNNING}"
export GOFLAGS=-mod=vendor
AUTH="${AUTH}" \
Expand Down Expand Up @@ -1803,6 +1804,7 @@ tasks:
- func: start-kms-kmip-server
- func: run-kmip-tests
vars:
KMS_MOCK_SERVERS_RUNNING: "true"
TOPOLOGY: "server"
AUTH: "noauth"
SSL: "nossl"
Expand Down
12 changes: 12 additions & 0 deletions mongo/integration/client_side_encryption_prose_test.go
Expand Up @@ -140,6 +140,9 @@ func TestClientSideEncryptionProse(t *testing.T) {
}
for _, tc := range testCases {
mt.Run(tc.provider, func(mt *mtest.T) {
if tc.provider == "kmip" && "" == os.Getenv("KMS_MOCK_SERVERS_RUNNING") {
mt.Skipf("Skipping test as KMS_MOCK_SERVERS_RUNNING is not set")
}
var startedEvents []*event.CommandStartedEvent
monitor := &event.CommandMonitor{
Started: func(_ context.Context, evt *event.CommandStartedEvent) {
Expand Down Expand Up @@ -398,6 +401,9 @@ func TestClientSideEncryptionProse(t *testing.T) {
"expected error '%v' to contain substring '%v'", errStr, viewErrSubstr)
})
mt.RunOpts("corpus", noClientOpts, func(mt *mtest.T) {
if "" == os.Getenv("KMS_MOCK_SERVERS_RUNNING") {
mt.Skipf("Skipping test as KMS_MOCK_SERVERS_RUNNING is not set")
}
corpusSchema := readJSONFile(mt, "corpus-schema.json")
localSchemaMap := map[string]interface{}{
"db.coll": corpusSchema,
Expand Down Expand Up @@ -772,6 +778,9 @@ func TestClientSideEncryptionProse(t *testing.T) {
}
for _, tc := range testCases {
mt.Run(tc.name, func(mt *mtest.T) {
if strings.Contains(tc.name, "kmip") && "" == os.Getenv("KMS_MOCK_SERVERS_RUNNING") {
mt.Skipf("Skipping test as KMS_MOCK_SERVERS_RUNNING is not set")
}
cpt := setup(mt, nil, defaultKvClientOptions, validClientEncryptionOptions)
defer cpt.teardown(mt)

Expand Down Expand Up @@ -1332,6 +1341,9 @@ func TestClientSideEncryptionProse(t *testing.T) {

for _, tc := range testCases {
mt.Run(tc.name, func(mt *mtest.T) {
if tc.name =="kmip" && "" == os.Getenv("KMS_MOCK_SERVERS_RUNNING") {
mt.Skipf("Skipping test as KMS_MOCK_SERVERS_RUNNING is not set")
}
// call CreateDataKey with CEO no TLS with each provider and corresponding master key
cpt := setup(mt, nil, defaultKvClientOptions, validClientEncryptionOptionsWithoutClientCert)
defer cpt.teardown(mt)
Expand Down
4 changes: 4 additions & 0 deletions mongo/integration/client_side_encryption_spec_test.go
Expand Up @@ -9,6 +9,7 @@
package integration

import (
"os"
"path"
"testing"
)
Expand Down Expand Up @@ -52,6 +53,9 @@ func TestClientSideEncryptionSpec(t *testing.T) {

for _, fileName := range jsonFilesInDir(t, path.Join(dataPath, encryptionSpecName)) {
t.Run(fileName, func(t *testing.T) {
if fileName == "kmipKMS.json" && "" == os.Getenv("KMS_MOCK_SERVERS_RUNNING") {
t.Skipf("Skipping test as KMS_MOCK_SERVERS_RUNNING is not set")
}
runSpecTestFile(t, encryptionSpecName, fileName)
})
}
Expand Down

0 comments on commit 0c1a981

Please sign in to comment.