Merge pull request #507 from katlapinka/test-attach-detach
Add stress test for attaching and detaching multiple core devices.
This commit is contained in:
commit
8dc06a3904
53
test/functional/tests/stress/test_stress_attach_detach.py
Normal file
53
test/functional/tests/stress/test_stress_attach_detach.py
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
#
|
||||||
|
# Copyright(c) 2020 Intel Corporation
|
||||||
|
# SPDX-License-Identifier: BSD-3-Clause-Clear
|
||||||
|
#
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
import random
|
||||||
|
|
||||||
|
from api.cas import casadm
|
||||||
|
from core.test_run import TestRun
|
||||||
|
from storage_devices.disk import DiskTypeSet, DiskType, DiskTypeLowerThan
|
||||||
|
from test_utils.size import Size, Unit
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.require_disk("cache", DiskTypeSet([DiskType.optane, DiskType.nand]))
|
||||||
|
@pytest.mark.require_disk("core", DiskTypeLowerThan("cache"))
|
||||||
|
def test_stress_attach_detach():
|
||||||
|
"""
|
||||||
|
title: Stress test for attaching and detaching multiple core devices.
|
||||||
|
description: |
|
||||||
|
Validate the ability of CAS to attach and detach core devices using script commands.
|
||||||
|
pass_criteria:
|
||||||
|
- No system crash.
|
||||||
|
- Core devices are successfully attached and detached.
|
||||||
|
"""
|
||||||
|
iterations_number = 50
|
||||||
|
|
||||||
|
with TestRun.step("Prepare devices."):
|
||||||
|
cache_disk = TestRun.disks['cache']
|
||||||
|
cache_disk.create_partitions([Size(100, Unit.MebiByte)])
|
||||||
|
cache_part = cache_disk.partitions[0]
|
||||||
|
|
||||||
|
core_disk = TestRun.disks['core']
|
||||||
|
core_disk.create_partitions([Size(5, Unit.GibiByte)] * 8)
|
||||||
|
core_devices = core_disk.partitions
|
||||||
|
|
||||||
|
with TestRun.step("Start cache."):
|
||||||
|
cache = casadm.start_cache(cache_part)
|
||||||
|
cores = []
|
||||||
|
for dev in core_devices:
|
||||||
|
cores.append(cache.add_core(dev))
|
||||||
|
|
||||||
|
with TestRun.step("Attach and detach core devices in a loop."):
|
||||||
|
for _ in TestRun.iteration(range(0, iterations_number)):
|
||||||
|
TestRun.LOGGER.info("Detaching all core devices.")
|
||||||
|
for core in cores:
|
||||||
|
casadm.detach_core(cache.cache_id, core.core_id)
|
||||||
|
|
||||||
|
random.shuffle(cores)
|
||||||
|
|
||||||
|
TestRun.LOGGER.info("Attaching all core devices.")
|
||||||
|
for core in cores:
|
||||||
|
casadm.try_add(core.core_device, cache.cache_id, core.core_id)
|
Loading…
Reference in New Issue
Block a user