Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Execute quicktest for each SM driver #133

Merged
merged 1 commit into from
Jan 19, 2024
Merged
Show file tree
Hide file tree
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
28 changes: 16 additions & 12 deletions jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,6 @@
"paths": ["tests/packages"],
"markers": "",
},
"quicktest": {
"description": "XAPI's quicktest, not so quick by the way",
"requirements": [
"Any pool.",
"Execution depends on the SRs present, as each SR from the pool will get tested.",
],
"nb_pools": 1,
"params": {},
"paths": ["tests/quicktest"],
},
"storage-main": {
"description": "tests all storage drivers, but avoids migrations and reboots",
"requirements": [
Expand All @@ -80,7 +70,7 @@
"--sr-disk": "auto",
},
"paths": ["tests/storage"],
"markers": "(small_vm or no_vm) and not reboot",
"markers": "(small_vm or no_vm) and not reboot and not quicktest",
"name_filter": "not migration",
},
"storage-migrations": {
Expand Down Expand Up @@ -115,7 +105,21 @@
"--sr-disk": "auto",
},
"paths": ["tests/storage"],
"markers": "reboot and not flaky",
"markers": "reboot and not flaky and not quicktest",
},
"storage-quicktest": {
"description": "runs `quicktest on all storage drivers`",
"requirements": [
"A pool with at least 3 hosts.",
"An additional free disk on every host.",
"Configuration in data.py for each remote SR that will be tested.",
],
"nb_pools": 1,
"params": {
"--sr-disk": "auto",
},
"paths": ["tests/storage"],
"markers": "quicktest",
},
"sb-main": {
"description": "tests uefistored/varstored and SecureBoot using a small unix VM (or no VM when none needed)",
Expand Down
13 changes: 13 additions & 0 deletions lib/sr.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,16 @@ def create_vdi(self, name_label, virtual_size=64):
'sr-uuid': self.uuid
})
return VDI(self, vdi_uuid)

def run_quicktest(self):
logging.info(f"Run quicktest on SR {self.uuid}")
# Always display the output of quicktest, failed or not.
# This will duplicate the output in some cases, but it ensures we always have it for failure analysis,
# even when quicktest leaves SRs in a state which makes teardown fail (in this case, pytest often doesn't
# manage to display the details of the failed command, for a reason unknown - no usable reproducer found)
try:
output = self.pool.master.ssh(['/opt/xensource/debug/quicktest', '-sr', self.uuid])
logging.info(f"Quicktest output: {output}")
except commands.SSHCommandFailed as e:
logging.error(f"Quicktest output: {e.stdout}")
raise
1 change: 1 addition & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ markers =
reboot: tests that reboot one or more hosts.
flaky: flaky tests. Usually pass, but sometimes fail unexpectedly.
complex_prerequisites: tests whose prerequisites are complex and may require special attention.
quicktest: runs `quicktest`
log_cli = 1
log_cli_level = info
log_cli_format = %(asctime)s %(levelname)s %(message)s
Expand Down
Empty file removed tests/quicktest/__init__.py
Empty file.
11 changes: 0 additions & 11 deletions tests/quicktest/test_quicktest.py

This file was deleted.

4 changes: 4 additions & 0 deletions tests/storage/cephfs/test_cephfs_sr.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ def test_create_and_destroy_sr(self, host, cephfs_device_config, pool_with_ceph)

@pytest.mark.usefixtures("cephfs_sr")
class TestCephFSSR:
@pytest.mark.quicktest
def test_quicktest(self, cephfs_sr):
cephfs_sr.run_quicktest()

def test_vdi_is_not_open(self, vdi_on_cephfs_sr):
assert not vdi_is_open(vdi_on_cephfs_sr)

Expand Down
4 changes: 4 additions & 0 deletions tests/storage/ext/test_ext_sr.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ def test_create_and_destroy_sr(self, host, sr_disk):

@pytest.mark.usefixtures("ext_sr")
class TestEXTSR:
@pytest.mark.quicktest
def test_quicktest(self, ext_sr):
ext_sr.run_quicktest()

def test_vdi_is_not_open(self, vdi_on_ext_sr):
assert not vdi_is_open(vdi_on_ext_sr)

Expand Down
4 changes: 4 additions & 0 deletions tests/storage/glusterfs/test_glusterfs_sr.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ def test_create_and_destroy_sr(self, host, glusterfs_device_config, pool_with_gl

@pytest.mark.usefixtures("sr_disk_for_all_hosts", "glusterfs_sr")
class TestGlusterFSSR:
@pytest.mark.quicktest
def test_quicktest(self, glusterfs_sr):
glusterfs_sr.run_quicktest()

def test_vdi_is_not_open(self, vdi_on_glusterfs_sr):
assert not vdi_is_open(vdi_on_glusterfs_sr)

Expand Down
1 change: 1 addition & 0 deletions tests/storage/linstor/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def pool_with_linstor(hostA2, lvm_disk, pool_with_saved_yum_state):
host.yum_install([LINSTOR_PACKAGE], enablerepo="xcp-ng-linstor-testing")
# Needed because the linstor driver is not in the xapi sm-plugins list
# before installing the LINSTOR packages.
host.ssh(["systemctl", "restart", "multipathd"])
host.restart_toolstack(verify=True)

yield pool
Expand Down
4 changes: 4 additions & 0 deletions tests/storage/linstor/test_linstor_sr.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ def test_create_and_destroy_sr(self, pool_with_linstor):

@pytest.mark.usefixtures("linstor_sr")
class TestLinstorSR:
@pytest.mark.quicktest
def test_quicktest(self, linstor_sr):
linstor_sr.run_quicktest()

def test_vdi_is_not_open(self, vdi_on_linstor_sr):
assert not vdi_is_open(vdi_on_linstor_sr)

Expand Down
4 changes: 4 additions & 0 deletions tests/storage/lvm/test_lvm_sr.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ def test_create_and_destroy_sr(self, host, sr_disk):

@pytest.mark.usefixtures("lvm_sr")
class TestLVMSR:
@pytest.mark.quicktest
def test_quicktest(self, lvm_sr):
lvm_sr.run_quicktest()

def test_vdi_is_not_open(self, vdi_on_lvm_sr):
assert not vdi_is_open(vdi_on_lvm_sr)

Expand Down
4 changes: 4 additions & 0 deletions tests/storage/lvmoiscsi/test_lvmoiscsi_sr.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ def test_create_and_destroy_sr(self, host, lvmoiscsi_device_config):

@pytest.mark.usefixtures("lvmoiscsi_sr")
class TestLVMOISCSISR:
@pytest.mark.quicktest
def test_quicktest(self, lvmoiscsi_sr):
lvmoiscsi_sr.run_quicktest()

def test_vdi_is_not_open(self, vdi_on_lvmoiscsi_sr):
assert not vdi_is_open(vdi_on_lvmoiscsi_sr)

Expand Down
4 changes: 4 additions & 0 deletions tests/storage/moosefs/test_moosefs_sr.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ def test_create_and_destroy_sr(self, moosefs_device_config, pool_with_moosefs_en

@pytest.mark.usefixtures("moosefs_sr")
class TestMooseFSSR:
@pytest.mark.quicktest
def test_quicktest(self, moosefs_sr):
moosefs_sr.run_quicktest()

def test_vdi_is_not_open(self, vdi_on_moosefs_sr):
assert not vdi_is_open(vdi_on_moosefs_sr)

Expand Down
4 changes: 4 additions & 0 deletions tests/storage/nfs/test_nfs_sr.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ def test_create_and_destroy_sr(self, host, nfs_device_config):

@pytest.mark.usefixtures("nfs_sr")
class TestNFSSR:
@pytest.mark.quicktest
def test_quicktest(self, nfs_sr):
nfs_sr.run_quicktest()

def test_vdi_is_not_open(self, vdi_on_nfs_sr):
assert not vdi_is_open(vdi_on_nfs_sr)

Expand Down
4 changes: 4 additions & 0 deletions tests/storage/xfs/test_xfs_sr.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ def test_create_and_destroy_sr(self, sr_disk, host_with_xfsprogs):

@pytest.mark.usefixtures("xfs_sr")
class TestXFSSR:
@pytest.mark.quicktest
def test_quicktest(self, xfs_sr):
xfs_sr.run_quicktest()

def test_vdi_is_not_open(self, vdi_on_xfs_sr):
assert not vdi_is_open(vdi_on_xfs_sr)

Expand Down
4 changes: 4 additions & 0 deletions tests/storage/zfs/test_zfs_sr.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ def test_create_and_destroy_sr(self, host):

@pytest.mark.usefixtures("zpool_vol0")
class TestZFSSR:
@pytest.mark.quicktest
def test_quicktest(self, zfs_sr):
zfs_sr.run_quicktest()

def test_vdi_is_not_open(self, vdi_on_zfs_sr):
assert not vdi_is_open(vdi_on_zfs_sr)

Expand Down
Loading