mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-13 22:05:59 +00:00
Remove test for disabling aggregated discovery
This commit is contained in:
parent
24267f6aa7
commit
0593746f60
@ -103,54 +103,3 @@ func TestAggregationEnabled(t *testing.T) {
|
|||||||
assert.Equal(t, tc.expected, body)
|
assert.Equal(t, tc.expected, body)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestAggregationDisabled(t *testing.T) {
|
|
||||||
defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, genericfeatures.AggregatedDiscoveryEndpoint, false)()
|
|
||||||
|
|
||||||
unaggregated := fakeHTTPHandler{data: "unaggregated"}
|
|
||||||
aggregated := fakeHTTPHandler{data: "aggregated"}
|
|
||||||
wrapped := WrapAggregatedDiscoveryToHandler(unaggregated, aggregated)
|
|
||||||
|
|
||||||
testCases := []struct {
|
|
||||||
accept string
|
|
||||||
expected string
|
|
||||||
}{
|
|
||||||
{
|
|
||||||
// Misconstructed/incorrect accept headers should be passed to the unaggregated handler to return an error
|
|
||||||
accept: "application/json;foo=bar",
|
|
||||||
expected: "unaggregated",
|
|
||||||
}, {
|
|
||||||
// Empty accept headers are valid and should be handled by the unaggregated handler
|
|
||||||
accept: "",
|
|
||||||
expected: "unaggregated",
|
|
||||||
}, {
|
|
||||||
|
|
||||||
accept: aggregatedJSONAccept,
|
|
||||||
expected: "unaggregated",
|
|
||||||
}, {
|
|
||||||
accept: aggregatedProtoAccept,
|
|
||||||
expected: "unaggregated",
|
|
||||||
}, {
|
|
||||||
accept: jsonAccept,
|
|
||||||
expected: "unaggregated",
|
|
||||||
}, {
|
|
||||||
accept: protobufAccept,
|
|
||||||
expected: "unaggregated",
|
|
||||||
}, {
|
|
||||||
// Server should return the first accepted type.
|
|
||||||
// If aggregation is disabled, the unaggregated type should be returned.
|
|
||||||
accept: aggregatedJSONAccept + "," + jsonAccept,
|
|
||||||
expected: "unaggregated",
|
|
||||||
}, {
|
|
||||||
// Server should return the first accepted type.
|
|
||||||
// If aggregation is disabled, the unaggregated type should be returned.
|
|
||||||
accept: aggregatedProtoAccept + "," + protobufAccept,
|
|
||||||
expected: "unaggregated",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, tc := range testCases {
|
|
||||||
body := fetchPath(wrapped, discoveryPath, tc.accept)
|
|
||||||
assert.Equal(t, tc.expected, body)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user