Remove WinDSR feature gate unit test

This commit is contained in:
Dawei Wei
2025-07-23 17:33:57 +00:00
committed by Dawei Wei
parent 1cead78757
commit a806e069e2

View File

@@ -1524,74 +1524,6 @@ func TestWinDSRWithOverlayEnabled(t *testing.T) {
}
}
func TestDSRFeatureGateValidation(t *testing.T) {
testCases := []struct {
name string
enableDSR bool
featureGate bool
expectFailure bool
}{
{
name: "DSR enabled but feature gate disabled",
enableDSR: true,
featureGate: false,
expectFailure: true,
},
{
name: "DSR enabled and feature gate enabled",
enableDSR: true,
featureGate: true,
expectFailure: false,
},
{
name: "DSR disabled, feature gate does not matter",
enableDSR: false,
featureGate: false,
expectFailure: false,
},
}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
// Mock feature gate
featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, kubefeatures.WinDSR, tc.featureGate)
config := config.KubeProxyWinkernelConfiguration{
EnableDSR: tc.enableDSR,
NetworkName: testNetwork,
SourceVip: serviceVip,
}
hostMacProvider := &testHostMacProvider{macAddress: macAddress}
hcnMock := getHcnMock(NETWORK_TYPE_OVERLAY)
_, err := newProxierInternal(
v1.IPv4Protocol, // ipFamily
testNodeName, // nodeName
netutils.ParseIPSloppy("192.168.1.1"), // nodeIP
nil, // serviceHealthServer (not needed in this unit test)
nil, // healthzServer (not needed in this unit test)
0, // healthzPort
hcnMock, // hcnImpl
hostMacProvider, // hostMacProvider
config, // kube-proxy config
false, // waitForHNSOverlay
)
if tc.expectFailure {
if err == nil {
t.Errorf("Expected failure for case %q, but got success", tc.name)
}
} else {
if err != nil {
t.Errorf("Expected success for case %q, but got error: %v", tc.name, err)
}
}
})
}
}
func makeNSN(namespace, name string) types.NamespacedName {
return types.NamespacedName{Namespace: namespace, Name: name}
}