Skip to content

Commit

Permalink
GODRIVER-2216 Change testKmsCtx expectedHost to be port-agnostic (#791)
Browse files Browse the repository at this point in the history
  • Loading branch information
benjirewis authored and Benjamin Rewis committed Nov 30, 2021
1 parent 88105be commit 0e4d846
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions x/mongo/driver/mongocrypt/mongocrypt_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"io/ioutil"
"os"
"path"
"strings"
"testing"

"go.mongodb.org/mongo-driver/bson"
Expand Down Expand Up @@ -124,9 +125,15 @@ func testKmsCtx(t *testing.T, ctx *Context, keyAltName bool) {
kmsCtx := ctx.NextKmsContext()
hostname, err := kmsCtx.HostName()
noerr(t, err)
expectedHost := "kms.us-east-1.amazonaws.com:443"
if hostname != expectedHost {
t.Fatalf("hostname mismatch; expected %s, got %s", expectedHost, hostname)

// TODO GODRIVER-2217: Simply check if hostname != expectedHost once all OSes build the latest
// libmongocrypt versions.
//
// Only check for the hostname. libmongocrypt versions that do not include MONGOCRYPT-352 will not
// include the default port "443".
expectedHost := "kms.us-east-1.amazonaws.com"
if !strings.Contains(hostname, expectedHost) {
t.Fatalf("hostname mismatch; expected %s to contain %s", hostname, expectedHost)
}

// get message to send to KMS
Expand Down

0 comments on commit 0e4d846

Please sign in to comment.