Skip to content

Commit 8ba6c38

Browse files
connectivity: disrupt deployment improved
Deploy conn-disrupt test actors only in the first test namespace in case of tests concurrent run to avoid resource wasting. Conn-disrupt tests always run at the beginning, sequentially and in the first test namespace. Kind workflow improved to start disrupt tests without concurrency and continue with concurrency. Signed-off-by: viktor-kurchenko <[email protected]>
1 parent 6d90b8c commit 8ba6c38

File tree

5 files changed

+8
-6
lines changed

5 files changed

+8
-6
lines changed

.github/workflows/kind.yaml

+1-2
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,7 @@ jobs:
105105
# disruption), but we want to make sure that the command works as expected.
106106
#
107107
# Dispatch interval is set to 100ms, b/c otherwise (default is 0), the flow validation might time out.
108-
cilium connectivity test --test-namespace test-namespace \
109-
--test-concurrency=5 \
108+
cilium connectivity test --test-namespace test-namespace-1 \
110109
--conn-disrupt-dispatch-interval 100ms \
111110
--include-conn-disrupt-test --conn-disrupt-test-setup
112111

cli/connectivity.go

+1
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ func newConnectivityTests(params check.Parameters, logger *check.ConcurrentLogge
243243
for i := 0; i < params.TestConcurrency; i++ {
244244
params := params
245245
params.TestNamespace = fmt.Sprintf("%s-%d", params.TestNamespace, i+1)
246+
params.TestNamespaceIndex = i
246247
if params.ExternalTargetCANamespace == "" {
247248
params.ExternalTargetCANamespace = params.TestNamespace
248249
}

connectivity/check/check.go

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ type Parameters struct {
2323
AssumeCiliumVersion string
2424
CiliumNamespace string
2525
TestNamespace string
26+
TestNamespaceIndex int
2627
TestConcurrency int
2728
SingleNode bool
2829
PrintFlows bool

connectivity/check/context.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ func (ct *ConnectivityTest) SetupAndValidate(ctx context.Context, extra SetupHoo
346346
return fmt.Errorf("unable to detect nodes w/o Cilium IPs: %w", err)
347347
}
348348
}
349-
if match, _ := ct.Features.MatchRequirements((features.RequireEnabled(features.CIDRMatchNodes))); match {
349+
if match, _ := ct.Features.MatchRequirements(features.RequireEnabled(features.CIDRMatchNodes)); match {
350350
if err := ct.detectNodeCIDRs(ctx); err != nil {
351351
return fmt.Errorf("unable to detect node CIDRs: %w", err)
352352
}

connectivity/check/deployment.go

+4-3
Original file line numberDiff line numberDiff line change
@@ -429,8 +429,9 @@ func (ct *ConnectivityTest) deploy(ctx context.Context) error {
429429
return ct.deployPerf(ctx)
430430
}
431431

432-
// Deploy test-conn-disrupt actors
433-
if ct.params.ConnDisruptTestSetup {
432+
// Deploy test-conn-disrupt actors (only in the first
433+
// test namespace in case of tests concurrent run)
434+
if ct.params.ConnDisruptTestSetup && ct.params.TestNamespaceIndex == 0 {
434435
_, err = ct.clients.src.GetDeployment(ctx, ct.params.TestNamespace, testConnDisruptServerDeploymentName, metav1.GetOptions{})
435436
if err != nil {
436437
ct.Logf("✨ [%s] Deploying %s deployment...", ct.clients.src.ClusterName(), testConnDisruptServerDeploymentName)
@@ -1156,7 +1157,7 @@ func (ct *ConnectivityTest) deploymentList() (srcList []string, dstList []string
11561157
}
11571158
}
11581159

1159-
if ct.params.IncludeConnDisruptTest {
1160+
if ct.params.IncludeConnDisruptTest && ct.params.TestNamespaceIndex == 0 {
11601161
// We append the server and client deployment names to two different
11611162
// lists. This matters when running in multi-cluster mode, because
11621163
// the server is deployed in the local cluster (targeted by the "src"

0 commit comments

Comments
 (0)