Remove test for disabling aggregated discovery

This commit is contained in:
Jefftree 2024-02-27 18:27:54 -05:00
parent 24267f6aa7
commit 0593746f60

View File

@ -103,54 +103,3 @@ func TestAggregationEnabled(t *testing.T) {
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)
}
}