fix(e2e): harden test suite isolation, resource usage, and leader election timing

- Isolate TestLiveMigrationInBackground into dedicated e2e-livemigration namespace with t.Cleanup teardown.
- Switch VMI containerdisk image from fedora (1.2GB, 512MB RAM) to cirros-container-disk-demo (12MB, 128MB RAM), reducing Kind memory pressure by 75%.
- Filter pod list API calls with LabelSelector=kubevirt.io=virt-launcher to reduce API server serialization load.
- Override --descheduling-interval to 3s in startDeschedulerServer (e2e_leaderelection_test.go) so leader descheduler re-evaluates pod lifetime periodically.
- Exclude context cancellation/deadline from isClientRateLimiterError in e2e_test.go so context deadlines are not swallowed.
- Add t.Cleanup and IsAlreadyExists handling to prevent leftover resources from causing cascading failures.

Signed-off-by: Amir Alavi <amiralavi7@gmail.com>
This commit is contained in:
Amir Alavi
2026-08-09 11:18:09 -04:00
parent 51ecda87fb
commit ec736d7140
9 changed files with 322 additions and 297 deletions
+5 -3
View File
@@ -235,8 +235,10 @@ func initDescheduler(t *testing.T, ctx context.Context, featureGates featuregate
if dryRun {
if err := wait.PollUntilContextTimeout(ctx, 100*time.Millisecond, 5*time.Second, true, func(ctx context.Context) (bool, error) {
for _, obj := range objects {
// Only check for nodes - secrets are handled by namespacedSharedInformerFactory
if _, ok := obj.(*v1.Node); !ok {
// Only check for nodes and pods - secrets are handled by namespacedSharedInformerFactory
switch obj.(type) {
case *v1.Node, *v1.Pod:
default:
continue
}
exists, err := descheduler.kubeClientSandbox.hasRuntimeObjectInIndexer(obj)
@@ -256,7 +258,7 @@ func initDescheduler(t *testing.T, ctx context.Context, featureGates featuregate
}
return true, nil
}); err != nil {
t.Fatalf("nodes did not propagate to the indexer: %v", err)
t.Fatalf("objects did not propagate to the indexer: %v", err)
}
}