Skip to content

Commit 4f482c7

Browse files
[Test] compatibility fix for fingerprint test on OSX using go>1.18 (#478) (#479)
Co-authored-by: Laurent Saint-Félix <[email protected]>
1 parent a53f695 commit 4f482c7

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

elasticsearch_internal_test.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -850,23 +850,26 @@ tuSVaQmm5eqgaAxMamBXSyw1lir07byemyuEDg0mJ1rNUGsAY8P+LWr579gvKMme
850850

851851
// Without certificate and authority, client should fail on TLS
852852
client, _ := NewClient(config)
853-
res, err := client.Info()
854-
if _, ok := err.(x509.UnknownAuthorityError); !ok {
855-
t.Fatalf("Uknown error, expected UnknownAuthorityError, got: %s", err)
853+
_, err = client.Info()
854+
855+
if err.Error() != `x509: “instance” certificate is not standards compliant` {
856+
if _, ok := err.(x509.UnknownAuthorityError); !ok {
857+
t.Fatalf("Uknown error, expected UnknownAuthorityError, got: %s", err)
858+
}
856859
}
857860

858-
// We add the fingerprint corresponding ton testcert.LocalhostCert
861+
// We add the fingerprint corresponding to testcert.LocalhostCert
859862
//
860863
config.CertificateFingerprint = "7A3A6031CD097DA0EE84D65137912A84576B50194045B41F4F4B8AC1A98116BE"
861864
client, _ = NewClient(config)
862-
res, err = client.Info()
865+
res, err := client.Info()
863866
if err != nil {
864867
t.Fatal(err)
865868
}
866869
defer res.Body.Close()
867870

868871
data, _ := ioutil.ReadAll(res.Body)
869-
if bytes.Compare(data, body) != 0 {
872+
if !bytes.Equal(data, body) {
870873
t.Fatalf("unexpected payload returned: expected: %s, got: %s", body, data)
871874
}
872875
}

0 commit comments

Comments
 (0)