Parametrize autoscaling instance load length

We need the duration for which the instance for autoscaling
testing is under load parametrized. Currently with a static
duration of 2 minutes the scenario might fail in situations
with a high ceilometer polling interval. In these situations
the load might already be finished before ceilometer polls
for the CPU metric, which results in a seemingly low CPU
utilization, because of which the stack doesn't ever scale
up and the scenario fails.

With this patch, the load lasts 2x (the ceilometer polling
interval + prometheus scrape interval),
which guarantees that at least on polling period
will be with 100% load, which will result in a high CPU
utilization registered by ceilometer.

As a sideeffect this might slightly speedup the scenario
in situations with a low ceilometer polling interval.

Change-Id: Ib673e67800d2d16d552e734fea89772a0e937105
This commit is contained in:
Jaromir Wysoglad 2024-08-01 08:15:02 -04:00
parent a32f05c0ba
commit 4ec1f85148
2 changed files with 2 additions and 1 deletions

View File

@ -23,7 +23,7 @@
"#!/bin/sh\n",
"echo 'Loading CPU'\n",
"set -v\n",
"cat /dev/urandom > /dev/null & sleep 120 ; kill $! \n"
"cat /dev/urandom > /dev/null & sleep $ENVIRON['LOAD_LENGTH'] ; kill $! \n"
]]}
}
}

View File

@ -135,6 +135,7 @@ class PrometheusGabbiTest(manager.ScenarioTest):
"STACK_NAME": self.stack_name,
"RESOURCE_PREFIX": resource_prefix,
"PROMETHEUS_RATE_DURATION": str(prometheus_rate_duration),
"LOAD_LENGTH": str(prometheus_rate_duration * 2),
})