summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvamahaja <vamahaja@redhat.com>2020-12-03 14:44:38 +0530
committervamahaja <vamahaja@redhat.com>2020-12-08 11:07:23 +0530
commitd0bc92df671f56b2ae15f68a71b5af1e2529f544 (patch)
tree9d0f7cd97b3dc51cc3969d356ba37ae9419fa75e
parente298b5a967c4d8878ebd606adc604cd7fb6e162e (diff)
[TestFix] Add config to read i/o images
Add support to pass I/O image from config file Change-Id: I2c943ba0efaeab3a44eef63030965f36f8086c1b
-rw-r--r--openshift-storage-libs/openshiftstoragelibs/baseclass.py25
-rw-r--r--openshift-storage-libs/openshiftstoragelibs/openshift_ops.py29
-rwxr-xr-xtests/functional/arbiter/test_arbiter.py4
-rw-r--r--tests/functional/heketi/test_heketi_zones.py3
-rw-r--r--tests/functional/prometheous/test_prometheus_validations_file.py3
-rw-r--r--tests/functional/provisioning/test_dynamic_provisioning_file.py18
-rw-r--r--tests/functional/provisioning/test_pv_resize.py9
-rw-r--r--tests/functional/provisioning/test_storage_class_cases.py3
-rw-r--r--tests/glusterfs-containers-tests-config.yaml6
9 files changed, 51 insertions, 49 deletions
diff --git a/openshift-storage-libs/openshiftstoragelibs/baseclass.py b/openshift-storage-libs/openshiftstoragelibs/baseclass.py
index 81327c1..b596976 100644
--- a/openshift-storage-libs/openshiftstoragelibs/baseclass.py
+++ b/openshift-storage-libs/openshiftstoragelibs/baseclass.py
@@ -45,7 +45,6 @@ from openshiftstoragelibs.openshift_ops import (
get_pod_name_from_rc,
get_pv_name_from_pvc,
oc_create_app_dc_with_io,
- oc_create_busybox_app_dc_with_io,
oc_create_pvc,
oc_create_sc,
oc_create_secret,
@@ -127,6 +126,11 @@ class BaseClass(unittest.TestCase):
cls.heketi_logs_before_delete = bool(
g.config.get("common", {}).get("heketi_logs_before_delete", False))
+ cls.io_container_image_cirros = cls.openshift_config.get(
+ "io_container_images", {}).get("cirros", "cirros")
+ cls.io_container_image_busybox = cls.openshift_config.get(
+ "io_container_images", {}).get("busybox", "busybox")
+
cmd = "echo -n %s | base64" % cls.heketi_cli_key
ret, out, err = g.run(cls.ocp_master_node[0], cmd, "root")
if ret != 0:
@@ -434,7 +438,7 @@ class BaseClass(unittest.TestCase):
def create_dcs_with_pvc(
self, pvc_names, timeout=600, wait_step=5,
dc_name_prefix='autotests-dc', space_to_use=1048576, label=None,
- skip_cleanup=False, is_busybox=False):
+ skip_cleanup=False, image=None):
"""Create bunch of DCs with app PODs which use unique PVCs.
Args:
@@ -445,7 +449,7 @@ class BaseClass(unittest.TestCase):
dc_name_prefix(str): name prefix for deployement config.
space_to_use(int): space to use for io's in KB.
label (dict): keys and value for adding label into DC.
- is_busybox (bool): True for busybox app pod else default is False
+ image (str): container image used for I/O.
Returns: dictionary with following structure:
{
"pvc_name_1": ("dc_name_1", "pod_name_1"),
@@ -454,16 +458,17 @@ class BaseClass(unittest.TestCase):
"pvc_name_n": ("dc_name_n", "pod_name_n"),
}
"""
+ if not image:
+ image = self.io_container_image_cirros
+
pvc_names = (
pvc_names
if isinstance(pvc_names, (list, set, tuple)) else [pvc_names])
dc_and_pod_names, dc_names = {}, {}
- function = (oc_create_busybox_app_dc_with_io if is_busybox else
- oc_create_app_dc_with_io)
for pvc_name in pvc_names:
- dc_name = function(self.ocp_client[0], pvc_name,
- space_to_use=space_to_use,
- dc_name_prefix=dc_name_prefix, label=label)
+ dc_name = oc_create_app_dc_with_io(
+ self.ocp_client[0], pvc_name, space_to_use=space_to_use,
+ dc_name_prefix=dc_name_prefix, label=label, image=image)
dc_names[pvc_name] = dc_name
if not skip_cleanup:
self.addCleanup(oc_delete, self.ocp_client[0], 'dc', dc_name)
@@ -484,11 +489,11 @@ class BaseClass(unittest.TestCase):
def create_dc_with_pvc(
self, pvc_name, timeout=300, wait_step=10,
dc_name_prefix='autotests-dc', label=None,
- skip_cleanup=False, is_busybox=False):
+ skip_cleanup=False, image=None):
return self.create_dcs_with_pvc(
pvc_name, timeout, wait_step,
dc_name_prefix=dc_name_prefix, label=label,
- skip_cleanup=skip_cleanup, is_busybox=is_busybox)[pvc_name]
+ skip_cleanup=skip_cleanup, image=image)[pvc_name]
def create_heketi_volume_with_name_and_wait(
self, name, size, raise_on_cleanup_error=True,
diff --git a/openshift-storage-libs/openshiftstoragelibs/openshift_ops.py b/openshift-storage-libs/openshiftstoragelibs/openshift_ops.py
index fb60a00..b8ba40e 100644
--- a/openshift-storage-libs/openshiftstoragelibs/openshift_ops.py
+++ b/openshift-storage-libs/openshiftstoragelibs/openshift_ops.py
@@ -411,7 +411,7 @@ def _oc_create_app_dc_with_io_image(hostname, pvc_name, dc_name_prefix,
def oc_create_app_dc_with_io(
hostname, pvc_name, dc_name_prefix="autotests-dc-with-app-io",
- replicas=1, space_to_use=1048576, label=None):
+ replicas=1, space_to_use=1048576, label=None, image="cirros"):
"""Create DC with app PODs and attached PVC, constantly running I/O.
Args:
@@ -423,34 +423,15 @@ def oc_create_app_dc_with_io(
replicas (int): amount of application POD replicas.
space_to_use (int): value in bytes which will be used for I/O.
label (dict): dict of keys and values to add labels in DC.
+ image (str): Container image for I/O.
"""
return _oc_create_app_dc_with_io_image(
hostname, pvc_name, dc_name_prefix, replicas, space_to_use,
- label, "cirros")
-
-
-def oc_create_busybox_app_dc_with_io(
- hostname, pvc_name, dc_name_prefix="autotests-dc-with-app-io",
- replicas=1, space_to_use=1048576, label=None):
- """Create DC with app PODs and attached PVC, constantly running I/O.
-
- Args:
- hostname (str): Node on which 'oc create' command will be executed.
- pvc_name (str): name of the Persistent Volume Claim to attach to
- the application PODs where constant I/O will run.
- dc_name_prefix (str): DC name will consist of this prefix and
- random str.
- replicas (int): amount of application POD replicas.
- space_to_use (int): value in bytes which will be used for I/O.
- label (dict): dict of keys and values to add labels in DC.
- """
- return _oc_create_app_dc_with_io_image(
- hostname, pvc_name, dc_name_prefix, replicas, space_to_use,
- label, "busybox")
+ label, image=image)
def oc_create_tiny_pod_with_volume(hostname, pvc_name, pod_name_prefix='',
- mount_path='/mnt'):
+ mount_path='/mnt', image='cirros'):
"""Create tiny POD from image in 10Mb with attached volume at /mnt"""
pod_name = "%s-%s" % (pod_name_prefix, utils.get_random_str())
pod_data = json.dumps({
@@ -463,7 +444,7 @@ def oc_create_tiny_pod_with_volume(hostname, pvc_name, pod_name_prefix='',
"terminationGracePeriodSeconds": 20,
"containers": [{
"name": pod_name,
- "image": "cirros", # noqa: 10 Mb! linux image
+ "image": image, # noqa: 10 Mb! linux image
"volumeMounts": [{"mountPath": mount_path, "name": "vol"}],
"command": [
"/bin/sh", "-ec",
diff --git a/tests/functional/arbiter/test_arbiter.py b/tests/functional/arbiter/test_arbiter.py
index a3c7279..8a0a8f9 100755
--- a/tests/functional/arbiter/test_arbiter.py
+++ b/tests/functional/arbiter/test_arbiter.py
@@ -155,7 +155,7 @@ class TestArbiterVolumeCreateExpandDelete(baseclass.BaseClass):
mount_path = "/mnt"
pod_name = openshift_ops.oc_create_tiny_pod_with_volume(
self.node, self.pvc_name, "test-arbiter-pvc-mount-on-app-pod",
- mount_path=mount_path)
+ mount_path=mount_path, image=self.io_container_image_cirros)
self.addCleanup(openshift_ops.oc_delete, self.node, 'pod', pod_name)
# Wait for POD be up and running
@@ -1513,7 +1513,7 @@ class TestArbiterVolumeCreateExpandDelete(baseclass.BaseClass):
# Create PVC and corresponding App pod
self.create_and_wait_for_pvc(sc_name=sc_name)
dc_name, pod_name = self.create_dc_with_pvc(
- self.pvc_name, is_busybox=True)
+ self.pvc_name, image=self.io_container_image_busybox)
# Get vol info
vol_info = openshift_ops.get_gluster_vol_info_by_pvc_name(
diff --git a/tests/functional/heketi/test_heketi_zones.py b/tests/functional/heketi/test_heketi_zones.py
index e1cd5dd..5c5d3df 100644
--- a/tests/functional/heketi/test_heketi_zones.py
+++ b/tests/functional/heketi/test_heketi_zones.py
@@ -626,7 +626,8 @@ class TestHeketiZones(baseclass.BaseClass):
# Create app dcs with I/O
for pvc_name in pvc_names:
app_dc = openshift_ops.oc_create_app_dc_with_io(
- self.node, pvc_name=pvc_name, dc_name_prefix=prefix)
+ self.node, pvc_name=pvc_name,
+ dc_name_prefix=prefix, image=self.io_container_image_cirros)
self.addCleanup(openshift_ops.oc_delete, self.node, 'dc', app_dc)
# Get pod names and label them
diff --git a/tests/functional/prometheous/test_prometheus_validations_file.py b/tests/functional/prometheous/test_prometheus_validations_file.py
index bcde3b9..313cb71 100644
--- a/tests/functional/prometheous/test_prometheus_validations_file.py
+++ b/tests/functional/prometheous/test_prometheus_validations_file.py
@@ -100,7 +100,8 @@ class TestPrometheusValidationFile(baseclass.BaseClass):
# Create PVC and wait for it to be in 'Bound' state
pvc_name = self.create_and_wait_for_pvc()
pod_name = openshift_ops.oc_create_tiny_pod_with_volume(
- self._master, pvc_name, "autotest-volume")
+ self._master, pvc_name, "autotest-volume",
+ image=self.io_container_image_cirros)
self.addCleanup(openshift_ops.oc_delete, self._master, 'pod', pod_name,
raise_on_absence=False)
diff --git a/tests/functional/provisioning/test_dynamic_provisioning_file.py b/tests/functional/provisioning/test_dynamic_provisioning_file.py
index 3a11cbe..cdffdbf 100644
--- a/tests/functional/provisioning/test_dynamic_provisioning_file.py
+++ b/tests/functional/provisioning/test_dynamic_provisioning_file.py
@@ -56,7 +56,8 @@ class TestDynamicProvisioningP0(BaseClass):
pvc_name = self.create_and_wait_for_pvc()
# Create DC with POD and attached PVC to it.
- dc_name = oc_create_app_dc_with_io(self.node, pvc_name)
+ dc_name = oc_create_app_dc_with_io(
+ self.node, pvc_name, image=self.io_container_image_cirros)
self.addCleanup(oc_delete, self.node, 'dc', dc_name)
self.addCleanup(scale_dc_pod_amount_and_wait, self.node, dc_name, 0)
@@ -144,7 +145,7 @@ class TestDynamicProvisioningP0(BaseClass):
# Create app POD with attached volume
app_1_pod_name = oc_create_tiny_pod_with_volume(
self.node, app_1_pvc_name, "test-pvc-mount-on-app-pod",
- mount_path=mount_path)
+ mount_path=mount_path, image=self.io_container_image_cirros)
self.addCleanup(
wait_for_resource_absence, self.node, 'pod', app_1_pod_name)
self.addCleanup(oc_delete, self.node, 'pod', app_1_pod_name)
@@ -184,7 +185,7 @@ class TestDynamicProvisioningP0(BaseClass):
# Create second app POD
app_2_pod_name = oc_create_tiny_pod_with_volume(
self.node, app_2_pvc_name, "test-pvc-mount-on-app-pod",
- mount_path=mount_path)
+ mount_path=mount_path, image=self.io_container_image_cirros)
self.addCleanup(
wait_for_resource_absence, self.node, 'pod', app_2_pod_name)
self.addCleanup(oc_delete, self.node, 'pod', app_2_pod_name)
@@ -225,7 +226,7 @@ class TestDynamicProvisioningP0(BaseClass):
# Create app POD with attached volume
pod_name = oc_create_tiny_pod_with_volume(
self.node, pvc_name, "test-pvc-mount-on-app-pod",
- mount_path=mount_path)
+ mount_path=mount_path, image=self.io_container_image_cirros)
self.addCleanup(
wait_for_resource_absence, self.node, 'pod', pod_name)
self.addCleanup(oc_delete, self.node, 'pod', pod_name)
@@ -312,7 +313,8 @@ class TestDynamicProvisioningP0(BaseClass):
pvc_name = self.create_and_wait_for_pvc(sc_name=sc_name)
# Create DC with POD and attached PVC to it.
- dc_name = oc_create_app_dc_with_io(self.node, pvc_name)
+ dc_name = oc_create_app_dc_with_io(
+ self.node, pvc_name, image=self.io_container_image_cirros)
self.addCleanup(oc_delete, self.node, 'dc', dc_name)
self.addCleanup(scale_dc_pod_amount_and_wait, self.node, dc_name, 0)
@@ -385,7 +387,8 @@ class TestDynamicProvisioningP0(BaseClass):
# Create DC with application PODs
dc_name = oc_create_app_dc_with_io(
- self.node, pvc_name, replicas=replicas)
+ self.node, pvc_name, replicas=replicas,
+ image=self.io_container_image_cirros)
self.addCleanup(oc_delete, self.node, 'dc', dc_name)
self.addCleanup(scale_dc_pod_amount_and_wait, self.node, dc_name, 0)
@@ -456,7 +459,8 @@ class TestDynamicProvisioningP0(BaseClass):
# Create DC with POD and attached PVC to it.
try:
- dc_name = oc_create_app_dc_with_io(self.node, self.pvc_name)
+ dc_name = oc_create_app_dc_with_io(
+ self.node, self.pvc_name, image=self.io_container_image_cirros)
pod_name = get_pod_name_from_dc(self.node, dc_name)
wait_for_pod_be_ready(self.node, pod_name)
finally:
diff --git a/tests/functional/provisioning/test_pv_resize.py b/tests/functional/provisioning/test_pv_resize.py
index dacdd99..f5833a9 100644
--- a/tests/functional/provisioning/test_pv_resize.py
+++ b/tests/functional/provisioning/test_pv_resize.py
@@ -70,7 +70,8 @@ class TestPvResizeClass(BaseClass):
pvc_name = self.create_and_wait_for_pvc()
# Create DC with POD and attached PVC to it.
- dc_name = oc_create_app_dc_with_io(node, pvc_name)
+ dc_name = oc_create_app_dc_with_io(
+ node, pvc_name, image=self.io_container_image_cirros)
self.addCleanup(oc_delete, node, 'dc', dc_name)
self.addCleanup(scale_dc_pod_amount_and_wait,
node, dc_name, 0)
@@ -194,7 +195,8 @@ class TestPvResizeClass(BaseClass):
pvc_name = self.create_and_wait_for_pvc(pvc_size=pvc_size_gb)
# Create DC with POD and attached PVC to it
- dc_name = oc_create_app_dc_with_io(self.node, pvc_name)
+ dc_name = oc_create_app_dc_with_io(
+ self.node, pvc_name, image=self.io_container_image_cirros)
self.addCleanup(oc_delete, self.node, 'dc', dc_name)
self.addCleanup(scale_dc_pod_amount_and_wait, self.node, dc_name, 0)
pod_name = get_pod_name_from_dc(self.node, dc_name)
@@ -270,7 +272,8 @@ class TestPvResizeClass(BaseClass):
pvc_name = self.create_and_wait_for_pvc(pvc_size=pv_size)
# Create DC with POD and attached PVC to it.
- dc_name = oc_create_app_dc_with_io(node, pvc_name)
+ dc_name = oc_create_app_dc_with_io(
+ node, pvc_name, image=self.io_container_image_cirros)
self.addCleanup(oc_delete, node, 'dc', dc_name)
self.addCleanup(scale_dc_pod_amount_and_wait,
node, dc_name, 0)
diff --git a/tests/functional/provisioning/test_storage_class_cases.py b/tests/functional/provisioning/test_storage_class_cases.py
index 27cfe82..976398d 100644
--- a/tests/functional/provisioning/test_storage_class_cases.py
+++ b/tests/functional/provisioning/test_storage_class_cases.py
@@ -146,7 +146,8 @@ class TestStorageClassCases(BaseClass):
"""
# create pod using pvc created
dc_name = oc_create_app_dc_with_io(
- self.ocp_master_node[0], self.pvc_name
+ self.ocp_master_node[0], self.pvc_name,
+ image=self.io_container_image_cirros
)
pod_name = get_pod_name_from_dc(self.ocp_master_node[0], dc_name)
self.addCleanup(oc_delete, self.ocp_master_node[0], "dc", dc_name)
diff --git a/tests/glusterfs-containers-tests-config.yaml b/tests/glusterfs-containers-tests-config.yaml
index 65409c4..cbccfbf 100644
--- a/tests/glusterfs-containers-tests-config.yaml
+++ b/tests/glusterfs-containers-tests-config.yaml
@@ -114,6 +114,12 @@ openshift:
prometheus_resources_selector: "<prometheus_recources_selector>"
alertmanager_resources_selector: "<alertmanager_resources_selector>"
+ # 'io_container_images' section covers the details of container images
+ # used for I/O
+ io_container_images:
+ cirros: quay.io/libpod/cirros
+ busybox: quay.io/prometheus/busybox
+
common:
allow_heketi_zones_update: False
check_heketi_db_inconsistencies: True