Skip to content

Commit 553e707

Browse files
memodiclaude
andcommitted
Use --background mode in privilege tests to prevent early cleanup
Tests were failing because: 1. Commands ran with --max-time=1m in foreground mode 2. After 1 minute, capture finished and auto-cleanup ran 3. Cleanup deleted the daemonset 4. isDaemonsetReady() was polling for a deleted daemonset 5. Test failed with context deadline exceeded Using --background mode prevents automatic cleanup when the capture finishes, allowing the test to verify daemonset privilege settings before cleanup runs. Also, Check for CLI is running instead of just daemnset. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent de30e58 commit 553e707

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

e2e/integration-tests/integration_test.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -254,20 +254,20 @@ var _ = g.Describe("NetObserv CLI e2e integration test suite", g.Ordered, func()
254254
{
255255
when: "Executing `oc netobserv flows`",
256256
it: "does not run as privileged",
257-
cliArgs: []string{"flows", "--copy=false", "--max-time=1m"},
257+
cliArgs: []string{"flows", "--background", "--max-time=1m"},
258258
matcher: o.BeFalse(),
259259
},
260260
{
261261
when: "Executing `oc netobserv flows --privileged=true`",
262262
it: "runs as privileged",
263-
cliArgs: []string{"flows", "--privileged=true", "--copy=false", "--max-time=1m"},
263+
cliArgs: []string{"flows", "--privileged=true", "--background", "--max-time=1m"},
264264
matcher: o.BeTrue(),
265265
},
266266

267267
{
268268
when: "Executing `oc netobserv flows --drops`",
269269
it: "runs as privileged",
270-
cliArgs: []string{"flows", "--drops", "--copy=false", "--max-time=1m"},
270+
cliArgs: []string{"flows", "--drops", "--background", "--max-time=1m"},
271271
matcher: o.BeTrue(),
272272
},
273273
}
@@ -284,9 +284,8 @@ var _ = g.Describe("NetObserv CLI e2e integration test suite", g.Ordered, func()
284284
o.Expect(err).NotTo(o.HaveOccurred(), fmt.Sprintf("Error starting command %v", err))
285285

286286
// Wait for CLI to be ready
287-
daemonsetReady, err := isDaemonsetReady(clientset, "netobserv-cli", cliNS)
288-
o.Expect(err).NotTo(o.HaveOccurred(), "agent daemonset didn't come ready")
289-
o.Expect(daemonsetReady).To(o.BeTrue(), "agent daemonset didn't come ready")
287+
cliRunning, err := isCLIRuning(clientset, cliNS)
288+
o.Expect(cliRunning).To(o.BeTrue(), fmt.Sprintf("CLI didn't come ready %v", err))
290289

291290
// Verify correct privilege setting
292291
ds, err := getDaemonSet(context.Background(), clientset, "netobserv-cli", cliNS)

0 commit comments

Comments
 (0)