Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 16 additions & 66 deletions test/extended/node/node_swap_cnv.go
Original file line number Diff line number Diff line change
Expand Up @@ -383,58 +383,8 @@ var _ = g.Describe("[Jira:Node/Kubelet][sig-node][Feature:NodeSwap][Serial][Disr
framework.Logf("All %d control plane nodes ignored drop-in file as expected", len(controlPlaneNodes))
})

// TC6: Verify directory is auto-recreated after deletion and kubelet restart
g.It("TC6: should verify drop-in directory is auto-recreated after deletion", func(ctx context.Context) {
skipOnSingleNodeTopology(oc) //skip this test for SNO
// Get a CNV worker node for tests
cnvWorkerNode = getCNVWorkerNodeName(ctx, oc)
o.Expect(cnvWorkerNode).NotTo(o.BeEmpty(), "No CNV worker nodes available")

framework.Logf("=== TC6: Testing drop-in directory auto-recreation ===")
framework.Logf("Executing on node: %s", cnvWorkerNode)

g.By("Checking if directory exists before deletion")
output, err := ExecOnNodeWithChroot(oc, cnvWorkerNode, "ls", "-la", cnvDropInDir)
if err != nil {
framework.Logf("Directory does not exist")
} else {
framework.Logf("Output:\n%s", output)
}

g.By("Deleting drop-in directory")
framework.Logf("Running: rm -rf %s", cnvDropInDir)
_, _ = ExecOnNodeWithChroot(oc, cnvWorkerNode, "rm", "-rf", cnvDropInDir)
framework.Logf("Directory deletion command executed")

g.By("Verifying directory is deleted")
framework.Logf("Running: ls -la %s (expecting failure)", cnvDropInDir)
_, err = ExecOnNodeWithChroot(oc, cnvWorkerNode, "ls", "-la", cnvDropInDir)
o.Expect(err).To(o.HaveOccurred(), "Directory should not exist after deletion")
framework.Logf("Confirmed: Directory does not exist after deletion")

g.By("Restarting kubelet")
err = restartKubeletOnNode(ctx, oc, cnvWorkerNode)
o.Expect(err).NotTo(o.HaveOccurred())

g.By("Waiting for node to be ready")
waitForNodeToBeReady(ctx, oc, cnvWorkerNode)

g.By("Verifying directory was auto-recreated")
output, err = ExecOnNodeWithChroot(oc, cnvWorkerNode, "ls", "-la", cnvDropInDir)
o.Expect(err).NotTo(o.HaveOccurred(), "Directory should be auto-recreated after kubelet restart")
framework.Logf("Output:\n%s", output)

g.By("Verifying kubelet is running")
output, err = ExecOnNodeWithChroot(oc, cnvWorkerNode, "systemctl", "is-active", "kubelet")
o.Expect(err).NotTo(o.HaveOccurred())
framework.Logf("kubelet status: %s", strings.TrimSpace(output))
o.Expect(strings.TrimSpace(output)).To(o.Equal("active"))

framework.Logf("=== TC6 PASSED ===")
})

// TC7: Validate security and permissions of drop-in directory
g.It("TC7: should validate security and permissions of drop-in directory", func(ctx context.Context) {
// TC6: Validate security and permissions of drop-in directory
g.It("TC6: should validate security and permissions of drop-in directory", func(ctx context.Context) {
skipOnSingleNodeTopology(oc) //skip this test for SNO
// Get a CNV worker node for tests
cnvWorkerNode = getCNVWorkerNodeName(ctx, oc)
Expand Down Expand Up @@ -507,8 +457,8 @@ var _ = g.Describe("[Jira:Node/Kubelet][sig-node][Feature:NodeSwap][Serial][Disr
framework.Logf("- File permissions: %s (expected: 644/600)", filePerms)
})

// TC8: Validate cluster stability and performance
g.It("TC8: should verify cluster stability with LimitedSwap enabled", func(ctx context.Context) {
// TC7: Validate cluster stability and performance
g.It("TC7: should verify cluster stability with LimitedSwap enabled", func(ctx context.Context) {
skipOnSingleNodeTopology(oc) //skip this test for SNO
// Get a CNV worker node for tests
cnvWorkerNode = getCNVWorkerNodeName(ctx, oc)
Expand Down Expand Up @@ -592,8 +542,8 @@ var _ = g.Describe("[Jira:Node/Kubelet][sig-node][Feature:NodeSwap][Serial][Disr
framework.Logf("- Stability after 30 seconds: CONFIRMED")
})

// TC9: Validate non-CNV cluster unaffected
g.It("TC9: should verify non-CNV workers have no swap configuration", func(ctx context.Context) {
// TC8: Validate non-CNV cluster unaffected
g.It("TC8: should verify non-CNV workers have no swap configuration", func(ctx context.Context) {
framework.Logf("=== TC9: Testing non-CNV workers have no swap configuration ===")

// Get a CNV worker node and temporarily remove its CNV label
Expand Down Expand Up @@ -664,8 +614,8 @@ var _ = g.Describe("[Jira:Node/Kubelet][sig-node][Feature:NodeSwap][Serial][Disr
framework.Logf("- swapBehavior: %s (NoSwap/default)", config.MemorySwap.SwapBehavior)
})

// TC10: Validate behavior with multiple conflicting drop-in files
g.It("TC10: should apply correct precedence with multiple files", func(ctx context.Context) {
// TC9: Validate behavior with multiple conflicting drop-in files
g.It("TC9: should apply correct precedence with multiple files", func(ctx context.Context) {
skipOnSingleNodeTopology(oc) //skip this test for SNO
// Get a CNV worker node for tests
cnvWorkerNode = getCNVWorkerNodeName(ctx, oc)
Expand Down Expand Up @@ -733,8 +683,8 @@ var _ = g.Describe("[Jira:Node/Kubelet][sig-node][Feature:NodeSwap][Serial][Disr
framework.Logf("- 99-* file correctly overrides 98-* file (lexicographic order)")
})

// TC11: Validate multi-node consistency and synchronization with checksum verification
g.It("TC11: should maintain consistent configuration with checksum verification across CNV nodes", func(ctx context.Context) {
// TC10: Validate multi-node consistency and synchronization with checksum verification
g.It("TC10: should maintain consistent configuration with checksum verification across CNV nodes", func(ctx context.Context) {
skipOnSingleNodeTopology(oc) //skip this test for SNO
framework.Logf("=== TC11: Testing multi-node consistency with checksum verification ===")

Expand Down Expand Up @@ -881,9 +831,9 @@ var _ = g.Describe("[Jira:Node/Kubelet][sig-node][Feature:NodeSwap][Serial][Disr
framework.Logf("- All nodes remain Ready: YES")
})

// TC12: Validate LimitedSwap config when OS-level swap is not enabled
// TC11: Validate LimitedSwap config when OS-level swap is not enabled
// This test verifies kubelet gracefully handles LimitedSwap config even without OS swap
g.It("TC12: should handle LimitedSwap config gracefully when OS swap is disabled", func(ctx context.Context) {
g.It("TC11: should handle LimitedSwap config gracefully when OS swap is disabled", func(ctx context.Context) {
skipOnSingleNodeTopology(oc) //skip this test for SNO
framework.Logf("=== TC12: Testing LimitedSwap config when OS swap is disabled ===")

Expand Down Expand Up @@ -1043,10 +993,10 @@ var _ = g.Describe("[Jira:Node/Kubelet][sig-node][Feature:NodeSwap][Serial][Disr
framework.Logf("- Kubelet handles LimitedSwap gracefully even without OS swap")
})

// TC13: Validate behavior with various swap sizes
// TC12: Validate behavior with various swap sizes
// This test creates temporary swap files on the node for testing different sizes
// It requires sufficient disk space and may take longer to complete
g.It("TC13: should work correctly with various swap sizes", func(ctx context.Context) {
g.It("TC12: should work correctly with various swap sizes", func(ctx context.Context) {
skipOnSingleNodeTopology(oc) //skip this test for SNO
// Get a CNV worker node for tests
cnvWorkerNode = getCNVWorkerNodeName(ctx, oc)
Expand Down Expand Up @@ -1221,8 +1171,8 @@ var _ = g.Describe("[Jira:Node/Kubelet][sig-node][Feature:NodeSwap][Serial][Disr
framework.Logf("LimitedSwap works correctly with all tested swap sizes")
})

// TC14: Validate swap metrics and observability via Prometheus
g.It("TC14: should expose swap metrics correctly via Prometheus", func(ctx context.Context) {
// TC13: Validate swap metrics and observability via Prometheus
g.It("TC13: should expose swap metrics correctly via Prometheus", func(ctx context.Context) {
skipOnSingleNodeTopology(oc) //skip this test for SNO
// Get a CNV worker node for tests
cnvWorkerNode = getCNVWorkerNodeName(ctx, oc)
Expand Down