From ed7c3f115a6bb6c0733857860c737fbeb51c87c8 Mon Sep 17 00:00:00 2001 From: Sylvain Laperche Date: Mon, 29 Jun 2020 16:36:31 +0200 Subject: [PATCH] test/volume: add test for noformat volume Closes: #2421 Signed-off-by: Sylvain Laperche --- tests/post/features/volume.feature | 17 +++++++++++++++++ tests/post/steps/test_volume.py | 5 ++++- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/tests/post/features/volume.feature b/tests/post/features/volume.feature index cb36912a33..1583f01732 100644 --- a/tests/post/features/volume.feature +++ b/tests/post/features/volume.feature @@ -166,3 +166,20 @@ Feature: Volume management When I delete the Volume 'test-volume11' Then the Volume 'test-volume11' does not exist And the PersistentVolume 'test-volume11' does not exist + + Scenario: Test volume creation (raw sparseLoopDevice) + Given the Kubernetes API is available + When I create the following Volume: + apiVersion: storage.metalk8s.scality.com/v1alpha1 + kind: Volume + metadata: + name: test-volume12 + spec: + nodeName: bootstrap + storageClassName: metalk8s-prometheus + sparseLoopDevice: + size: 10Gi + noFormat: true + Then the Volume 'test-volume12' is 'Available' + And the PersistentVolume 'test-volume12' has size '10Gi' + And the backing storage for Volume 'test-volume12' is created diff --git a/tests/post/steps/test_volume.py b/tests/post/steps/test_volume.py index d138738a9d..890d58bb95 100644 --- a/tests/post/steps/test_volume.py +++ b/tests/post/steps/test_volume.py @@ -434,7 +434,10 @@ def check_storage_is_created(context, host, name): size = int(host.check_output('stat -c %s {}'.format(path))) assert _quantity_to_bytes(capacity) == size # Check that the loop device is mounted. - host.run_test('test -b /dev/disk/by-uuid/{}'.format(uuid)) + if volume['spec']['sparseLoopDevice'].get('noFormat', False): + host.run_test('test -b /dev/disk/by-partlabel/{}'.format(uuid)) + else: + host.run_test('test -b /dev/disk/by-uuid/{}'.format(uuid)) @then(parsers.parse("the backing storage for Volume '{name}' is deleted"))