Added test where both policies are set

This commit is contained in:
Max Renaud
2022-03-30 03:11:58 +00:00
parent ba4f5c4e7b
commit 198367a486
3 changed files with 46 additions and 2 deletions

View File

@@ -6087,6 +6087,16 @@ func TestNoEndpointsMetric(t *testing.T) {
{"10.0.1.3", "host2"},
},
},
{
name: "both policies are set and there is non-zero local endpoints",
internalTrafficPolicy: &internalTrafficPolicyLocal,
externalTrafficPolicy: externalTrafficPolicyLocal,
endpoints: []endpoint{
{"10.0.1.1", testHostname},
{"10.0.1.2", "host1"},
{"10.0.1.3", "host2"},
},
},
{
name: "internalTrafficPolicy is set and there is zero local endpoint",
internalTrafficPolicy: &internalTrafficPolicyLocal,
@@ -6107,6 +6117,18 @@ func TestNoEndpointsMetric(t *testing.T) {
},
expectedSyncProxyRulesNoLocalEndpointsTotalExternal: 1,
},
{
name: "both policies are set and there is zero local endpoint",
internalTrafficPolicy: &internalTrafficPolicyLocal,
externalTrafficPolicy: externalTrafficPolicyLocal,
endpoints: []endpoint{
{"10.0.1.1", "host0"},
{"10.0.1.2", "host1"},
{"10.0.1.3", "host2"},
},
expectedSyncProxyRulesNoLocalEndpointsTotalInternal: 1,
expectedSyncProxyRulesNoLocalEndpointsTotalExternal: 1,
},
}
for _, tc := range testCases {