Skip to content

Commit

Permalink
Revert PodLogs method and fixed TestNamespaceHealthInvalidRate
Browse files Browse the repository at this point in the history
  • Loading branch information
PrinsonF77 committed Mar 28, 2024
1 parent dc4e618 commit 02c44a7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion tests/integration/tests/namespaces_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func TestNamespaceHealthInvalidRate(t *testing.T) {

// 500 and error message which is not failing in unmarshalling
require.Error(err)
require.Contains(err.Error(), "not a valid duration string: \"invalid\"")
require.Contains(err.Error(), "not a valid duration string: \\\"invalid\\\"")
require.NotEqual(200, code)
}

Expand Down
2 changes: 1 addition & 1 deletion tests/integration/tests/pod_logs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func TestLogsInvalidLineCount(t *testing.T) {
}

func assertEmptyLogs(logs *business.PodLog, err error, require *require.Assertions) {
require.Error(err)
require.NoError(err)
require.NotNil(logs)
require.Empty(logs.Entries)
}
Expand Down
12 changes: 8 additions & 4 deletions tests/integration/utils/kiali/kiali_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -613,11 +613,15 @@ func FirstPodName(name, namespace string) (string, error) {

func PodLogs(name, namespace string, params map[string]string) (*business.PodLog, error) {
url := fmt.Sprintf("%s/api/namespaces/%s/pods/%s/logs?sinceTime=%d&%s", client.kialiURL, namespace, name, TimeSinceSeconds(), ParamsAsString(params))
logs := new(business.PodLog)

_, err := getRequestAndUnmarshalInto(url, logs)
body, _, _, err := httpGETWithRetry(url, client.GetAuth(), TIMEOUT, nil, client.kialiCookies)
if err == nil {
return logs, nil
logs := new(business.PodLog)
err = json.Unmarshal(body, &logs)
if err == nil {
return logs, nil
} else {
return nil, err
}
} else {
return nil, err
}
Expand Down

0 comments on commit 02c44a7

Please sign in to comment.