Skip to content

Commit

Permalink
split error check
Browse files Browse the repository at this point in the history
  • Loading branch information
ranakan19 committed Nov 12, 2024
1 parent 209ef9a commit 6bb562d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,14 @@ func TestNewClientFail(t *testing.T) {
Namespace: "default",
},
}
// no specific reason to check if object is namespaced, ANY request to the actual api would trigger error indicating incorrect configuration of client
_, err = cl.IsObjectNamespaced(testObj)
require.Error(t, err)
// actual error is "failed to get restmapping: failed to get server groups: Get \"https://fail-cluster.com/api?timeout=1m0s\": dial tcp: lookup fail-cluster.com: no such host"
require.ErrorContains(t, err, "dial tcp: lookup fail-cluster.com: no such host")
require.ErrorContains(t, err, "dial tcp: lookup fail-cluster.com")
// for ci the error message is dial tcp: lookup fail-cluster.com on 127.0.0.53:53: no such host, could go the regex way or string submatching with wildcards
// having two separate checks for different substrings is an easy fix
require.ErrorContains(t, err, "no such host")
}

func TestPatchUserSignup(t *testing.T) {
Expand Down

0 comments on commit 6bb562d

Please sign in to comment.