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

Fixed issue with Endpoint pod count is not expected #8857

Merged
merged 5 commits into from
Nov 28, 2023
Merged
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
98 changes: 59 additions & 39 deletions tests/manage/mcg/test_endpoint_autoscale.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
import time
import logging
from ocs_ci.framework import config
from ocs_ci.framework.testlib import MCGTest, tier1, skipif_ocs_version
from ocs_ci.ocs import constants, ocp
from ocs_ci.framework.pytest_customization.marks import (
skipif_managed_service,
red_squad,
)
from ocs_ci.ocs.scale_noobaa_lib import get_endpoint_pod_count, get_hpa_utilization

log = logging.getLogger(__name__)

# @pytest.mark.polarion_id("OCS-XXXX")
# Skipped above 4.6 because of https://github.com/red-hat-storage/ocs-ci/issues/4129


@red_squad
@skipif_ocs_version(["<4.5", "<4.14"])
@skipif_managed_service
Expand All @@ -23,47 +29,61 @@ class TestEndpointAutoScale(MCGTest):
# with an autoscaling conifguration of 1-2
MIN_ENDPOINT_COUNT = 1
MAX_ENDPOINT_COUNT = 2
options = {
"create": [
("name", "job1"),
("name", "job2"),
("name", "job3"),
("runtime", "1200"),
],
"job1": [
("iodepth", "4"),
("rw", "randrw"),
("bs", "32k"),
("size", "64m"),
("numjobs", "4"),
],
"job2": [
("iodepth", "16"),
("rw", "randrw"),
("bs", "64k"),
("size", "512m"),
("numjobs", "4"),
],
"job3": [
("iodepth", "32"),
("rw", "randrw"),
("bs", "128k"),
("size", "1024m"),
("numjobs", "4"),
],
}

def test_scaling_under_load(self, mcg_job_factory):
self._assert_endpoint_count(1)

options = {
"create": [
("name", "job1"),
("name", "job2"),
("name", "job3"),
("runtime", "1200"),
],
"job1": [
("iodepth", "4"),
("rw", "randrw"),
("bs", "32k"),
("size", "64m"),
("numjobs", "4"),
],
"job2": [
("iodepth", "16"),
("rw", "randrw"),
("bs", "64k"),
("size", "512m"),
("numjobs", "4"),
],
"job3": [
("iodepth", "32"),
("rw", "randrw"),
("bs", "128k"),
("size", "1024m"),
("numjobs", "4"),
],
}
for i in range(10):
exec(f"job{i} = mcg_job_factory(custom_options={options})")
self._assert_endpoint_count(2)

for i in range(10):
exec(f"job{i}.delete()")
exec(f"job{i}.ocp.wait_for_delete(resource_name=job{i}.name, timeout=60)")
self._assert_endpoint_count(1)
self._assert_endpoint_count(self.MIN_ENDPOINT_COUNT)
endpoint_cnt = get_endpoint_pod_count(config.ENV_DATA["cluster_namespace"])
get_hpa_utilization(config.ENV_DATA["cluster_namespace"])
job_cnt = 0
wait_time = 30
job_list = list()
while endpoint_cnt < self.MAX_ENDPOINT_COUNT:
exec(f"job{job_cnt} = mcg_job_factory(custom_options=self.options)")
job_list.append(f"job{job_cnt}")
time.sleep(wait_time)
endpoint_cnt = get_endpoint_pod_count(config.ENV_DATA["cluster_namespace"])
hpa_cpu_utilization = get_hpa_utilization(
config.ENV_DATA["cluster_namespace"]
)
log.info(
f"HPA CPU utilization by noobaa-endpoint is {hpa_cpu_utilization}%"
)
if endpoint_cnt == self.MAX_ENDPOINT_COUNT:
break
job_cnt += 1
for i in job_list:
exec(f"{i}.delete()")
exec(f"{i}.ocp.wait_for_delete(resource_name={i}.name, timeout=60)")
self._assert_endpoint_count(self.MIN_ENDPOINT_COUNT)

def _assert_endpoint_count(self, desired_count):
pod = ocp.OCP(
Expand Down
Loading