Skip to content

Commit

Permalink
fix: ExternalTargetCANamespace name
Browse files Browse the repository at this point in the history
The fix for connectivity tests ExternalTargetCANamespace name.
The name must be namespace specific in case of tests
concurrent run for proper CiliumNetworkPolicy provisioning.

Signed-off-by: viktor-kurchenko <viktor.kurchenko@isovalent.com>
  • Loading branch information
viktor-kurchenko committed Jun 26, 2024
1 parent 9658f02 commit 4a1d50a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
4 changes: 3 additions & 1 deletion cli/connectivity.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,9 @@ func newConnectivityTests(params check.Parameters, logger *check.ConcurrentLogge
connTests := make([]*check.ConnectivityTest, 0, params.TestConcurrency)
for i := 0; i < params.TestConcurrency; i++ {
params := params
params.TestNamespace = fmt.Sprintf("%s-%d", params.TestNamespace, i+1)
ns := fmt.Sprintf("%s-%d", params.TestNamespace, i+1)
params.TestNamespace = ns
params.ExternalTargetCANamespace = ns
params.ExternalDeploymentPort += i
params.EchoServerHostPort += i
params.JunitFile = junit.NamespacedFileName(params.TestNamespace, params.JunitFile)
Expand Down
20 changes: 12 additions & 8 deletions cli/connectivity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,29 @@ func TestNewConnectivityTests(t *testing.T) {
}{
{
params: check.Parameters{
FlowValidation: check.FlowValidationModeDisabled,
TestNamespace: "cilium-test",
FlowValidation: check.FlowValidationModeDisabled,
TestNamespace: "cilium-test",
ExternalTargetCANamespace: "cilium-test",
},
expectedCount: 1,
expectedTestNamespaces: []string{"cilium-test"},
},
{
params: check.Parameters{
FlowValidation: check.FlowValidationModeDisabled,
TestNamespace: "cilium-test",
TestConcurrency: -1,
FlowValidation: check.FlowValidationModeDisabled,
TestNamespace: "cilium-test",
ExternalTargetCANamespace: "cilium-test",
TestConcurrency: -1,
},
expectedCount: 1,
expectedTestNamespaces: []string{"cilium-test"},
},
{
params: check.Parameters{
FlowValidation: check.FlowValidationModeDisabled,
TestNamespace: "cilium-test",
TestConcurrency: 3,
FlowValidation: check.FlowValidationModeDisabled,
TestNamespace: "cilium-test",
ExternalTargetCANamespace: "cilium-test",
TestConcurrency: 3,
},
expectedCount: 3,
expectedTestNamespaces: []string{"cilium-test-1", "cilium-test-2", "cilium-test-3"},
Expand All @@ -53,6 +56,7 @@ func TestNewConnectivityTests(t *testing.T) {
require.Equal(t, tt.expectedCount, len(actual))
for i, n := range tt.expectedTestNamespaces {
require.Equal(t, n, actual[i].Params().TestNamespace)
require.Equal(t, n, actual[i].Params().ExternalTargetCANamespace)
}
}
}

0 comments on commit 4a1d50a

Please sign in to comment.