Skip to content

Commit 33de6c0

Browse files
author
Peng Zhou
committed
fix test bug with index out of range [1] with length 1
1 parent 931d4e7 commit 33de6c0

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

test/e2e/4_tls_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,9 @@ func TestTlsWithNamedCert(t *testing.T) {
240240
}
241241
certURIs := gjson.Get(certs, `certificate-default-list.list-items.list-item.#.uriref`).Array()
242242
t.Log("Certificates URL list", certURIs)
243+
if len(certURIs) < 2 {
244+
t.Fatalf("Expected at least 2 certificates, found %d", len(certURIs))
245+
}
243246
cert0Url := fmt.Sprintf("https://localhost:8002%s?format=json", certURIs[0])
244247
cert1Url := fmt.Sprintf("https://localhost:8002%s?format=json", certURIs[1])
245248
command = fmt.Sprintf("curl -k --anyauth -u %s:%s %s", adminUsername, adminPassword, cert0Url)
@@ -406,6 +409,9 @@ func TestTlsWithMultiNode(t *testing.T) {
406409
}
407410
certURIs := gjson.Get(certs, `certificate-default-list.list-items.list-item.#.uriref`).Array()
408411
t.Log("Dnode Cert Url", certURIs)
412+
if len(certURIs) < 2 {
413+
t.Fatalf("Expected at least 2 certificates, found %d", len(certURIs))
414+
}
409415
cert0Url := fmt.Sprintf("https://localhost:8002%s?format=json", certURIs[0])
410416
cert1Url := fmt.Sprintf("https://localhost:8002%s?format=json", certURIs[1])
411417
command = fmt.Sprintf("curl -k --anyauth -u %s:%s %s", adminUsername, adminPassword, cert0Url)

0 commit comments

Comments
 (0)