Skip to content

Commit

Permalink
test scale up added
Browse files Browse the repository at this point in the history
Signed-off-by: Aviadp <[email protected]>
  • Loading branch information
AviadP committed Apr 29, 2024
1 parent 0c72961 commit 52df0e3
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 2 deletions.
21 changes: 21 additions & 0 deletions ocs_ci/ocs/replica_one.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
CEPHBLOCKPOOL,
STORAGECLASS,
DEPLOYMENT,
STORAGECLUSTER,
STATUS_READY,
)
from ocs_ci.ocs.exceptions import CommandFailed

Expand Down Expand Up @@ -198,3 +200,22 @@ def delete_replica1_cephblockpools(cbp_object: OCP):
toolbox_pod.exec_cmd_on_pod(command)

log.info(f"deleting {replica1_pool_name}")


def modify_replica1_osd_count(new_osd_count):
"""
Modify number of OSDs associated with replica1
Args:
new_osd_count (str): number, represent the duplicatoin number of replica1 osd.
for instance, selecting 2, creates 6 osds
"""
storage_cluster = OCP(kind=STORAGECLUSTER, name="ocs-storagecluster")
storage_cluster.exec_oc_cmd(
f"patch storagecluster ocs-storagecluster -n openshift-storage "
f'--type json --patch \'[{{"op": "replace", "path": '
f'"/spec/managedResources/cephNonResilientPools/count", "value": {new_osd_count} }}]\''
)

storage_cluster.wait_for_resource(condition=STATUS_READY)
16 changes: 14 additions & 2 deletions tests/functional/storageclass/test_replica1.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
delete_replica1_cephblockpools_cr,
get_replica1_osd_deployment,
count_osd_pods,
modify_replica1_osd_count,
)


Expand Down Expand Up @@ -115,5 +116,16 @@ def test_validate_device_class(self):
def test_topology_validation(self):
pass

def test_expend_replica1_cluster(self):
pass
@pytest.mark.parametrize("new_osd_count", [2, 3, 4])
def test_scale_up_osd(setup_rellica1, new_osd_count):
storage_cluster = OCP(kind=STORAGECLUSTER)
current_osd_count = count_osd_pods()

modify_replica1_osd_count(new_osd_count)

storage_cluster.wait_for_resource(condition=STATUS_READY)

new_osd_count_after_test = count_osd_pods()
assert new_osd_count_after_test == (
current_osd_count + new_osd_count
), f"Expected {new_osd_count_after_test} OSDs, but got {current_osd_count} OSDs"

0 comments on commit 52df0e3

Please sign in to comment.