Skip to content

Commit 747bcd9

Browse files
committed
Normalize more discovery requests
We recognize (and sort) more group-discovery requests - now that we have them - so that golden test output can tolerate parallel/random discovery as done by kubectl.
1 parent f399604 commit 747bcd9

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

pkg/test/httprecorder/request_log.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,11 @@ func (l *RequestLog) SortGETs() {
123123
switch u.Path {
124124
case "/apis", "/api/v1", "/apis/v1":
125125
return u.Path, true
126+
default:
127+
tokens := strings.Split(strings.TrimPrefix(u.Path, "/"), "/")
128+
if len(tokens) == 3 && tokens[0] == "apis" {
129+
return u.Path, true
130+
}
126131
}
127132
return "", false
128133
}

pkg/test/testreconciler/simpletest/controller_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ func testSimpleReconciler(h *testharness.Harness, testdir string, applier applie
142142
h.Logf("replacing old url prefix %q", "http://"+restConfig.Host)
143143
requestLog.ReplaceURLPrefix("http://"+restConfig.Host, "http://kube-apiserver")
144144
requestLog.RemoveUserAgent()
145+
requestLog.SortGETs()
145146
// Workaround for non-determinism in https://github.com/kubernetes/kubernetes/blob/79a62d62350fb600f97d1f6309c3274515b3587a/staging/src/k8s.io/client-go/tools/cache/reflector.go#L301
146147
requestLog.RegexReplaceURL("&timeoutSeconds=.*&", "&timeoutSeconds=<replaced>&")
147148

0 commit comments

Comments
 (0)