Skip to content

Commit

Permalink
tests: add logs to KPI integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
pmalek committed Nov 4, 2024
1 parent 1d2b9e8 commit 00f3c3e
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions test/integration/test_kongplugininstallation.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package integration

import (
"bytes"
"fmt"
"net/http"
"strings"
Expand Down Expand Up @@ -368,7 +369,9 @@ func verifyCustomPlugins(t *testing.T, ip string, expectedHeaders ...http.Header
httpClient, err := helpers.CreateHTTPClient(nil, "")
require.NoError(t, err)
require.EventuallyWithT(t, func(c *assert.CollectT) {
resp, err := httpClient.Get(fmt.Sprintf("http://%s/test", ip))
u := fmt.Sprintf("http://%s/test", ip)
t.Logf("verifying connectivity to the HTTPRoute at %s", u)
resp, err := httpClient.Get(u)
if !assert.NoError(c, err) {
return
}
Expand All @@ -378,10 +381,18 @@ func verifyCustomPlugins(t *testing.T, ip string, expectedHeaders ...http.Header
}
for _, h := range expectedHeaders {
for k, v := range h {
assert.Equal(c, v, resp.Header.Values(k))
actualV := resp.Header.Values(k)
if !assert.Equal(c, v, actualV,
"expected header %s to be %s but it was %s", k, v, actualV,
) {
var b bytes.Buffer
_, err := b.ReadFrom(resp.Body)
require.NoError(t, err)
t.Logf("response body: %s", b.String())
}
}
}
}, 15*time.Second, time.Second)
}, time.Minute, 250*time.Millisecond)
}

func createRandomNamespace(t *testing.T) string {
Expand Down

0 comments on commit 00f3c3e

Please sign in to comment.