From d8b195c3e72e8d4ebf8d3d8831aadbda9fea5e32 Mon Sep 17 00:00:00 2001 From: Myasnikov Daniil Date: Wed, 15 Apr 2026 10:23:00 +0500 Subject: [PATCH 1/3] [tests] Add BATS E2E coverage for vm-disk source.disk and source.image MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Follow-up to PR #2258: adds two new @test cases in hack/e2e-apps/vm-disk.bats covering the new vm-disk clone paths — source.image (golden image from cozy-public) and source.disk (PVC clone within tenant namespace). Existing source.http coverage in vminstance.bats is not touched. Co-Authored-By: Claude Opus 4.6 Signed-off-by: Myasnikov Daniil --- hack/e2e-apps/vm-disk.bats | 81 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 hack/e2e-apps/vm-disk.bats diff --git a/hack/e2e-apps/vm-disk.bats b/hack/e2e-apps/vm-disk.bats new file mode 100644 index 00000000..00ec8fb2 --- /dev/null +++ b/hack/e2e-apps/vm-disk.bats @@ -0,0 +1,81 @@ +#!/usr/bin/env bats + +# Tests for vm-disk source types: source.image and source.disk. +# Existing source.http coverage lives in vminstance.bats. + +@test "Create a VM Disk from source.image (golden image clone)" { + name='test-image-src' + kubectl -n tenant-test delete vmdisks.apps.cozystack.io $name --ignore-not-found --timeout=2m || true + kubectl apply -f - < Date: Wed, 15 Apr 2026 10:37:41 +0500 Subject: [PATCH 2/3] [tests] Use Alpine for source.disk base instead of Ubuntu noble The clone step is what this test exercises, not the HTTP import. Ubuntu noble is ~600MB; Alpine is ~50MB, which cuts CI time without losing coverage. Co-Authored-By: Claude Opus 4.6 Signed-off-by: Myasnikov Daniil --- hack/e2e-apps/vm-disk.bats | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hack/e2e-apps/vm-disk.bats b/hack/e2e-apps/vm-disk.bats index 00ec8fb2..185e2764 100644 --- a/hack/e2e-apps/vm-disk.bats +++ b/hack/e2e-apps/vm-disk.bats @@ -35,7 +35,8 @@ EOF kubectl -n tenant-test delete vmdisks.apps.cozystack.io $clone --ignore-not-found --timeout=2m || true kubectl -n tenant-test delete vmdisks.apps.cozystack.io $base --ignore-not-found --timeout=2m || true - # Create the base disk via source.http (fast URL re-used from vminstance.bats) + # Create the base disk via source.http. Alpine is ~50MB vs Ubuntu noble's ~600MB, + # which keeps this test fast; the assertion here is the clone step, not the HTTP import. kubectl apply -f - < Date: Thu, 16 Apr 2026 13:24:42 +0500 Subject: [PATCH 3/3] [tests] Address review feedback for vm-disk E2E tests - Add teardown() function for reliable cleanup after each test - Increase HelmRelease wait timeout from 5s to 30s - Switch base disk in source.disk test from source.http to source.image - Remove inline cleanup in favor of teardown Assisted-By: Claude Signed-off-by: Myasnikov Daniil --- hack/e2e-apps/vm-disk.bats | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/hack/e2e-apps/vm-disk.bats b/hack/e2e-apps/vm-disk.bats index 185e2764..cf1a1f90 100644 --- a/hack/e2e-apps/vm-disk.bats +++ b/hack/e2e-apps/vm-disk.bats @@ -3,6 +3,10 @@ # Tests for vm-disk source types: source.image and source.disk. # Existing source.http coverage lives in vminstance.bats. +teardown() { + kubectl -n tenant-test delete vmdisks.apps.cozystack.io test-image-src test-disk-clone test-disk-base --ignore-not-found --timeout=2m || true +} + @test "Create a VM Disk from source.image (golden image clone)" { name='test-image-src' kubectl -n tenant-test delete vmdisks.apps.cozystack.io $name --ignore-not-found --timeout=2m || true @@ -21,10 +25,9 @@ spec: storageClass: replicated EOF sleep 5 - kubectl -n tenant-test wait hr vm-disk-$name --timeout=5s --for=condition=ready + kubectl -n tenant-test wait hr vm-disk-$name --timeout=30s --for=condition=ready kubectl -n tenant-test wait dv vm-disk-$name --timeout=250s --for=condition=ready kubectl -n tenant-test wait pvc vm-disk-$name --timeout=200s --for=jsonpath='{.status.phase}'=Bound - kubectl -n tenant-test delete vmdisks.apps.cozystack.io $name } @test "Create a VM Disk from source.disk (PVC clone)" { @@ -35,8 +38,8 @@ EOF kubectl -n tenant-test delete vmdisks.apps.cozystack.io $clone --ignore-not-found --timeout=2m || true kubectl -n tenant-test delete vmdisks.apps.cozystack.io $base --ignore-not-found --timeout=2m || true - # Create the base disk via source.http. Alpine is ~50MB vs Ubuntu noble's ~600MB, - # which keeps this test fast; the assertion here is the clone step, not the HTTP import. + # Create the base disk from a golden image. The assertion here is the clone + # step (source.disk), not the base provisioning method. kubectl apply -f - <