Skip to content
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
9 changes: 9 additions & 0 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,12 @@ def pytest_addoption(parser: pytest.Parser) -> None:
default="1GiB",
help="Default volume size for tests"
)
parser.addoption(
"--write-volume-cap",
action="store",
default="2GiB",
help="Maximum amount of data written to a volume"
)

def pytest_configure(config: pytest.Config) -> None:
global_config.ignore_ssh_banner = config.getoption('--ignore-ssh-banner')
Expand All @@ -119,6 +125,9 @@ def pytest_configure(config: pytest.Config) -> None:
volume_size = config.getoption('--volume-size')
assert volume_size is not None
global_config.volume_size = parse_size(volume_size)
write_volume_cap = config.getoption('--write-volume-cap')
assert write_volume_cap is not None
global_config.write_volume_cap = parse_size(write_volume_cap)

def pytest_generate_tests(metafunc: pytest.Metafunc) -> None:
if "vm_ref" in metafunc.fixturenames:
Expand Down
1 change: 1 addition & 0 deletions lib/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
ignore_ssh_banner = False
ssh_output_max_lines = 20
volume_size = 1 * GiB
write_volume_cap = 2 * GiB

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it twice volume size ?


def sr_device_config(datakey: str, *, required: list[str] = []) -> dict[str, str]:
import data # import here to avoid depending on this user file for collecting tests
Expand Down
8 changes: 4 additions & 4 deletions tests/storage/nfs/test_nfs_sr.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,17 +140,17 @@ def test_invalid_vdi_size(self, nfs_sr: SR, image_format: ImageFormat):
@pytest.mark.usefixtures('vm_ref')
@pytest.mark.parametrize('dispatch_nfs', ['vm_on_nfs_sr', 'vm_on_nfs4_sr'], indirect=True)
@pytest.mark.parametrize("compression", ["none", "gzip", "zstd"])
def test_xva_export_import(self, dispatch_nfs: VM, compression: XVACompression, temp_large_dir: str, defer: Defer) \
-> None:
if "NFS4" in dispatch_nfs.vdis[0].sr.get_name_label() and config.volume_size > 20 * GiB:
def test_xva_export_import(self, dispatch_nfs: VM, compression: XVACompression, temp_large_dir: str,
defer: Defer) -> None:
if "NFS4" in dispatch_nfs.vdis[0].sr.get_name_label() and config.write_volume_cap > 20 * GiB:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry if asked previously but why magic numbers are duplicated, and not a constant introduced?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because I didn't feel a need for it, I suppose.

Indeed, I think we've already had this discussion :)

pytest.skip("Skipping NFSv4 large VDI test (known performance issue)")
xva_export_import(dispatch_nfs, compression, temp_large_dir, defer)

@pytest.mark.small_vm
@pytest.mark.parametrize('dispatch_nfs', ['nfs_sr', 'nfs4_sr'], indirect=True)
def test_vdi_export_import(self, storage_test_vm: VM, dispatch_nfs: SR, image_format: ImageFormat,
temp_large_dir: str, defer: Defer) -> None:
if "NFS4" in dispatch_nfs.get_name_label() and config.volume_size > 20 * GiB:
if "NFS4" in dispatch_nfs.get_name_label() and config.write_volume_cap > 20 * GiB:
pytest.skip("Skipping NFSv4 large VDI test (known performance issue)")
vdi_export_import(storage_test_vm, dispatch_nfs, image_format, temp_large_dir, defer)

Expand Down
Loading
Loading