Skip to content

Commit

Permalink
tests: add logs to konnect license test (#5858)
Browse files Browse the repository at this point in the history
  • Loading branch information
pmalek authored Apr 11, 2024
1 parent ea1864c commit 8e54ae9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 6 additions & 4 deletions test/e2e/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -681,13 +681,15 @@ func getLicenseFromAdminAPI(ctx context.Context, env environments.Environment, a
defer resp.Body.Close()
body, err := io.ReadAll(resp.Body)
if err != nil {
return license, err
return license, fmt.Errorf("failed to read response body: %w; body: %s", err, body)
}
if resp.StatusCode != http.StatusOK {
return license, nil
return license, fmt.Errorf("unexpected status code: %d; body: %s", resp.StatusCode, body)
}
if err = json.Unmarshal(body, &license); err != nil {
return licenseOutput{}, fmt.Errorf("could not unmarshal license response: %w; body: %s", err, body)
}
err = json.Unmarshal(body, &license)
return license, err
return license, nil
}

func verifyPostgres(ctx context.Context, t *testing.T, env environments.Environment) {
Expand Down
2 changes: 2 additions & 0 deletions test/e2e/konnect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ func TestKonnectLicenseActivation(t *testing.T) {
require.Eventually(t, func() bool {
license, err := getLicenseFromAdminAPI(ctx, env, "")
if err != nil {
t.Logf("failed to get license: %v", err)
return false
}
return license.License.Expiration == ""
Expand All @@ -117,6 +118,7 @@ func TestKonnectLicenseActivation(t *testing.T) {
assert.Eventually(t, func() bool {
license, err := getLicenseFromAdminAPI(ctx, env, "")
if err != nil {
t.Logf("failed to get license: %v", err)
return false
}
return license.License.Expiration != ""
Expand Down

0 comments on commit 8e54ae9

Please sign in to comment.