Skip to content

Commit 0e4d846

Browse files
benjirewisBenjamin Rewis
authored andcommitted
GODRIVER-2216 Change testKmsCtx expectedHost to be port-agnostic (#791)
1 parent 88105be commit 0e4d846

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

x/mongo/driver/mongocrypt/mongocrypt_test.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"io/ioutil"
1515
"os"
1616
"path"
17+
"strings"
1718
"testing"
1819

1920
"go.mongodb.org/mongo-driver/bson"
@@ -124,9 +125,15 @@ func testKmsCtx(t *testing.T, ctx *Context, keyAltName bool) {
124125
kmsCtx := ctx.NextKmsContext()
125126
hostname, err := kmsCtx.HostName()
126127
noerr(t, err)
127-
expectedHost := "kms.us-east-1.amazonaws.com:443"
128-
if hostname != expectedHost {
129-
t.Fatalf("hostname mismatch; expected %s, got %s", expectedHost, hostname)
128+
129+
// TODO GODRIVER-2217: Simply check if hostname != expectedHost once all OSes build the latest
130+
// libmongocrypt versions.
131+
//
132+
// Only check for the hostname. libmongocrypt versions that do not include MONGOCRYPT-352 will not
133+
// include the default port "443".
134+
expectedHost := "kms.us-east-1.amazonaws.com"
135+
if !strings.Contains(hostname, expectedHost) {
136+
t.Fatalf("hostname mismatch; expected %s to contain %s", hostname, expectedHost)
130137
}
131138

132139
// get message to send to KMS

0 commit comments

Comments
 (0)