From 4c7948bb46254cab31c540f7be358848fd873bbe Mon Sep 17 00:00:00 2001 From: Noel Georgi Date: Fri, 20 Sep 2024 22:03:55 +0530 Subject: [PATCH] chore: better lvm2 tests Use LVM2 tests that relies on module loading by lvm. Fixes: #9300 Signed-off-by: Noel Georgi (cherry picked from commit 76318bd0bb008e9f43ae5fa86e7f862269e1ad0d) --- .github/workflows/ci.yaml | 14 +++++++++----- .github/workflows/integration-extensions-cron.yaml | 4 ++-- .github/workflows/integration-qemu-cron.yaml | 4 ++-- .../integration-qemu-encrypted-vip-cron.yaml | 6 +++--- .github/workflows/integration-qemu-race-cron.yaml | 6 +++++- .kres.yaml | 12 ++++++++---- hack/test/patches/dm-raid-module.yaml | 4 ++++ internal/integration/api/common.go | 2 +- internal/integration/api/volumes.go | 9 +++++++-- internal/integration/api/watchdog.go | 2 +- internal/integration/base/base.go | 5 +++++ internal/integration/k8s/apparmor.go | 2 +- 12 files changed, 48 insertions(+), 22 deletions(-) create mode 100644 hack/test/patches/dm-raid-module.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 02cf6fe20a..96c7f7d3c0 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,6 +1,6 @@ # THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT. # -# Generated on 2024-09-20T00:40:37Z by kres 8be5fa7. +# Generated on 2024-09-21T05:02:59Z by kres 8be5fa7. name: default concurrency: @@ -1464,7 +1464,7 @@ jobs: QEMU_EXTRA_DISKS: "3" QEMU_MEMORY_WORKERS: "4096" SHORT_INTEGRATION_TEST: "yes" - WITH_CONFIG_PATCH_WORKER: '@_out/installer-extensions-patch.yaml:@hack/test/patches/extensions.yaml' + WITH_CONFIG_PATCH_WORKER: '@_out/installer-extensions-patch.yaml:@hack/test/patches/extensions.yaml:@hack/test/patches/dm-raid-module.yaml' run: | sudo -E make e2e-qemu - name: save artifacts @@ -2774,7 +2774,7 @@ jobs: QEMU_EXTRA_DISKS: "3" QEMU_EXTRA_DISKS_DRIVERS: ide,nvme QEMU_EXTRA_DISKS_SIZE: "10240" - WITH_CONFIG_PATCH_WORKER: '@hack/test/patches/ephemeral-nvme.yaml' + WITH_CONFIG_PATCH_WORKER: '@hack/test/patches/ephemeral-nvme.yaml:@hack/test/patches/dm-raid-module.yaml' run: | sudo -E make e2e-qemu - name: save artifacts @@ -3086,10 +3086,10 @@ jobs: - name: e2e-qemu env: IMAGE_REGISTRY: registry.dev.siderolabs.io - QEMU_EXTRA_DISKS: "2" + QEMU_EXTRA_DISKS: "3" QEMU_EXTRA_DISKS_DRIVERS: ide,nvme QEMU_EXTRA_DISKS_SIZE: "10240" - WITH_CONFIG_PATCH_WORKER: '@hack/test/patches/ephemeral-nvme.yaml' + WITH_CONFIG_PATCH_WORKER: '@hack/test/patches/ephemeral-nvme.yaml:@hack/test/patches/dm-raid-module.yaml' WITH_DISK_ENCRYPTION: "true" WITH_KUBESPAN: "true" WITH_VIRTUAL_IP: "true" @@ -3193,7 +3193,11 @@ jobs: - name: e2e-qemu-race env: IMAGE_REGISTRY: registry.dev.siderolabs.io + QEMU_EXTRA_DISKS: "3" + QEMU_EXTRA_DISKS_DRIVERS: ide,nvme + QEMU_EXTRA_DISKS_SIZE: "10240" TAG_SUFFIX: -race + WITH_CONFIG_PATCH_WORKER: '@hack/test/patches/ephemeral-nvme.yaml:@hack/test/patches/dm-raid-module.yaml' run: | sudo -E make e2e-qemu - name: save artifacts diff --git a/.github/workflows/integration-extensions-cron.yaml b/.github/workflows/integration-extensions-cron.yaml index 9aa0d74a45..3e686f5b4d 100644 --- a/.github/workflows/integration-extensions-cron.yaml +++ b/.github/workflows/integration-extensions-cron.yaml @@ -1,6 +1,6 @@ # THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT. # -# Generated on 2024-09-21T09:26:00Z by kres 8be5fa7. +# Generated on 2024-09-23T09:06:18Z by kres 8be5fa7. name: integration-extensions-cron concurrency: @@ -113,7 +113,7 @@ jobs: QEMU_EXTRA_DISKS: "3" QEMU_MEMORY_WORKERS: "4096" SHORT_INTEGRATION_TEST: "yes" - WITH_CONFIG_PATCH_WORKER: '@_out/installer-extensions-patch.yaml:@hack/test/patches/extensions.yaml' + WITH_CONFIG_PATCH_WORKER: '@_out/installer-extensions-patch.yaml:@hack/test/patches/extensions.yaml:@hack/test/patches/dm-raid-module.yaml' run: | sudo -E make e2e-qemu - name: save artifacts diff --git a/.github/workflows/integration-qemu-cron.yaml b/.github/workflows/integration-qemu-cron.yaml index 08bedd4365..f00135cabc 100644 --- a/.github/workflows/integration-qemu-cron.yaml +++ b/.github/workflows/integration-qemu-cron.yaml @@ -1,6 +1,6 @@ # THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT. # -# Generated on 2024-09-21T09:26:00Z by kres 8be5fa7. +# Generated on 2024-09-23T09:06:18Z by kres 8be5fa7. name: integration-qemu-cron concurrency: @@ -84,7 +84,7 @@ jobs: QEMU_EXTRA_DISKS: "3" QEMU_EXTRA_DISKS_DRIVERS: ide,nvme QEMU_EXTRA_DISKS_SIZE: "10240" - WITH_CONFIG_PATCH_WORKER: '@hack/test/patches/ephemeral-nvme.yaml' + WITH_CONFIG_PATCH_WORKER: '@hack/test/patches/ephemeral-nvme.yaml:@hack/test/patches/dm-raid-module.yaml' run: | sudo -E make e2e-qemu - name: save artifacts diff --git a/.github/workflows/integration-qemu-encrypted-vip-cron.yaml b/.github/workflows/integration-qemu-encrypted-vip-cron.yaml index 99fb217c91..bbef0704c1 100644 --- a/.github/workflows/integration-qemu-encrypted-vip-cron.yaml +++ b/.github/workflows/integration-qemu-encrypted-vip-cron.yaml @@ -1,6 +1,6 @@ # THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT. # -# Generated on 2024-09-09T12:40:13Z by kres 8be5fa7. +# Generated on 2024-09-23T09:06:18Z by kres 8be5fa7. name: integration-qemu-encrypted-vip-cron concurrency: @@ -81,10 +81,10 @@ jobs: - name: e2e-qemu env: IMAGE_REGISTRY: registry.dev.siderolabs.io - QEMU_EXTRA_DISKS: "2" + QEMU_EXTRA_DISKS: "3" QEMU_EXTRA_DISKS_DRIVERS: ide,nvme QEMU_EXTRA_DISKS_SIZE: "10240" - WITH_CONFIG_PATCH_WORKER: '@hack/test/patches/ephemeral-nvme.yaml' + WITH_CONFIG_PATCH_WORKER: '@hack/test/patches/ephemeral-nvme.yaml:@hack/test/patches/dm-raid-module.yaml' WITH_DISK_ENCRYPTION: "true" WITH_KUBESPAN: "true" WITH_VIRTUAL_IP: "true" diff --git a/.github/workflows/integration-qemu-race-cron.yaml b/.github/workflows/integration-qemu-race-cron.yaml index c62ae64856..98875ddf62 100644 --- a/.github/workflows/integration-qemu-race-cron.yaml +++ b/.github/workflows/integration-qemu-race-cron.yaml @@ -1,6 +1,6 @@ # THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT. # -# Generated on 2024-09-09T12:40:13Z by kres 8be5fa7. +# Generated on 2024-09-23T09:06:18Z by kres 8be5fa7. name: integration-qemu-race-cron concurrency: @@ -90,7 +90,11 @@ jobs: - name: e2e-qemu-race env: IMAGE_REGISTRY: registry.dev.siderolabs.io + QEMU_EXTRA_DISKS: "3" + QEMU_EXTRA_DISKS_DRIVERS: ide,nvme + QEMU_EXTRA_DISKS_SIZE: "10240" TAG_SUFFIX: -race + WITH_CONFIG_PATCH_WORKER: '@hack/test/patches/ephemeral-nvme.yaml:@hack/test/patches/dm-raid-module.yaml' run: | sudo -E make e2e-qemu - name: save artifacts diff --git a/.kres.yaml b/.kres.yaml index 2defa7e230..08e1a54db8 100644 --- a/.kres.yaml +++ b/.kres.yaml @@ -332,7 +332,7 @@ spec: QEMU_EXTRA_DISKS: "3" QEMU_EXTRA_DISKS_SIZE: "10240" QEMU_EXTRA_DISKS_DRIVERS: "ide,nvme" - WITH_CONFIG_PATCH_WORKER: "@hack/test/patches/ephemeral-nvme.yaml" + WITH_CONFIG_PATCH_WORKER: "@hack/test/patches/ephemeral-nvme.yaml:@hack/test/patches/dm-raid-module.yaml" - name: save-talos-logs conditions: - always @@ -1017,7 +1017,7 @@ spec: withSudo: true environment: QEMU_MEMORY_WORKERS: 4096 - WITH_CONFIG_PATCH_WORKER: "@_out/installer-extensions-patch.yaml:@hack/test/patches/extensions.yaml" + WITH_CONFIG_PATCH_WORKER: "@_out/installer-extensions-patch.yaml:@hack/test/patches/extensions.yaml:@hack/test/patches/dm-raid-module.yaml" QEMU_EXTRA_DISKS: 3 SHORT_INTEGRATION_TEST: yes EXTRA_TEST_ARGS: -talos.extensions.qemu @@ -1153,10 +1153,10 @@ spec: WITH_VIRTUAL_IP: true WITH_KUBESPAN: true IMAGE_REGISTRY: registry.dev.siderolabs.io - QEMU_EXTRA_DISKS: "2" + QEMU_EXTRA_DISKS: "3" QEMU_EXTRA_DISKS_SIZE: "10240" QEMU_EXTRA_DISKS_DRIVERS: "ide,nvme" - WITH_CONFIG_PATCH_WORKER: "@hack/test/patches/ephemeral-nvme.yaml" + WITH_CONFIG_PATCH_WORKER: "@hack/test/patches/ephemeral-nvme.yaml:@hack/test/patches/dm-raid-module.yaml" - name: save-talos-logs conditions: - always @@ -1213,6 +1213,10 @@ spec: command: e2e-qemu withSudo: true environment: + QEMU_EXTRA_DISKS: "3" + QEMU_EXTRA_DISKS_SIZE: "10240" + QEMU_EXTRA_DISKS_DRIVERS: "ide,nvme" + WITH_CONFIG_PATCH_WORKER: "@hack/test/patches/ephemeral-nvme.yaml:@hack/test/patches/dm-raid-module.yaml" TAG_SUFFIX: -race IMAGE_REGISTRY: registry.dev.siderolabs.io - name: save-talos-logs diff --git a/hack/test/patches/dm-raid-module.yaml b/hack/test/patches/dm-raid-module.yaml new file mode 100644 index 0000000000..1e6984317f --- /dev/null +++ b/hack/test/patches/dm-raid-module.yaml @@ -0,0 +1,4 @@ +machine: + kernel: + modules: + - name: dm_raid diff --git a/internal/integration/api/common.go b/internal/integration/api/common.go index ae1ed7f2c1..006fcac11a 100644 --- a/internal/integration/api/common.go +++ b/internal/integration/api/common.go @@ -42,7 +42,7 @@ func (suite *CommonSuite) TearDownTest() { // TestVirtioModulesLoaded verifies that the virtio modules are loaded. func (suite *CommonSuite) TestVirtioModulesLoaded() { - if suite.Cluster == nil || suite.Cluster.Provisioner() != "qemu" { + if suite.Cluster == nil || suite.Cluster.Provisioner() != base.ProvisionerQEMU { suite.T().Skip("skipping virtio test since provisioner is not qemu") } diff --git a/internal/integration/api/volumes.go b/internal/integration/api/volumes.go index 3055839216..0d11b81836 100644 --- a/internal/integration/api/volumes.go +++ b/internal/integration/api/volumes.go @@ -185,6 +185,10 @@ func (suite *VolumesSuite) TestLVMActivation() { suite.T().Skip("skipping test in short mode.") } + if suite.Cluster == nil || suite.Cluster.Provisioner() != base.ProvisionerQEMU { + suite.T().Skip("skipping test for non-qemu provisioner") + } + node := suite.RandomDiscoveredNodeInternalIP(machine.TypeWorker) userDisks, err := suite.UserDisks(suite.ctx, node) @@ -211,7 +215,7 @@ func (suite *VolumesSuite) TestLVMActivation() { stdout, _, err = podDef.Exec( suite.ctx, - "nsenter --mount=/proc/1/ns/mnt -- lvcreate -n lv0 -L 1G vg0", + "nsenter --mount=/proc/1/ns/mnt -- lvcreate --mirrors=1 --type=raid1 --nosync -n lv0 -L 1G vg0", ) suite.Require().NoError(err) @@ -275,7 +279,8 @@ func (suite *VolumesSuite) lvmVolumeExists() bool { } // we test with creating a volume group with two logical volumes - return lvmVolumeCount == 2 + // one mirrored and one not, so we expect to see 6 volumes + return lvmVolumeCount == 6 } func init() { diff --git a/internal/integration/api/watchdog.go b/internal/integration/api/watchdog.go index 4aa5cf5a1e..e2c875559b 100644 --- a/internal/integration/api/watchdog.go +++ b/internal/integration/api/watchdog.go @@ -39,7 +39,7 @@ func (suite *WatchdogSuite) SuiteName() string { func (suite *WatchdogSuite) SetupTest() { suite.ctx, suite.ctxCancel = context.WithTimeout(context.Background(), 1*time.Minute) - if suite.Cluster == nil || suite.Cluster.Provisioner() != "qemu" { + if suite.Cluster == nil || suite.Cluster.Provisioner() != base.ProvisionerQEMU { suite.T().Skip("skipping watchdog test since provisioner is not qemu") } } diff --git a/internal/integration/base/base.go b/internal/integration/base/base.go index c287dd76ed..ee7654637e 100644 --- a/internal/integration/base/base.go +++ b/internal/integration/base/base.go @@ -15,6 +15,11 @@ import ( "github.com/siderolabs/talos/pkg/provision/access" ) +const ( + // ProvisionerQEMU is the name of the QEMU provisioner. + ProvisionerQEMU = "qemu" +) + // TalosSuite defines most common settings for integration test suites. type TalosSuite struct { // Endpoint to use to connect, if not set config is used diff --git a/internal/integration/k8s/apparmor.go b/internal/integration/k8s/apparmor.go index 1805dc04e5..b4eff0b5c8 100644 --- a/internal/integration/k8s/apparmor.go +++ b/internal/integration/k8s/apparmor.go @@ -35,7 +35,7 @@ func (suite *ApparmorSuite) TestApparmor() { suite.T().Skip("without full cluster state reaching out to the node IP is not reliable") } - if suite.Cluster.Provisioner() != "qemu" { + if suite.Cluster.Provisioner() != base.ProvisionerQEMU { suite.T().Skip("skipping apparmor test since provisioner is not qemu") }