Skip to content

Commit 192a727

Browse files
committed
add unit test for dynamic client ramp up
Signed-off-by: Michael Oviedo <[email protected]>
1 parent 0b9e609 commit 192a727

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

osbenchmark/worker_coordinator/worker_coordinator.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
# KIND, either express or implied. See the License for the
2222
# specific language governing permissions and limitations
2323
# under the License.
24-
24+
2525
import asyncio
2626
import collections
2727
import concurrent.futures

tests/worker_coordinator/worker_coordinator_test.py

+18
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,24 @@ def test_client_reaches_join_point_which_completes_parent(self):
250250
self.assertEqual(1, target.on_task_finished.call_count)
251251
self.assertEqual(4, target.drive_at.call_count)
252252

253+
@run_async
254+
async def test_load_test_clients_override(self):
255+
self.cfg.add(config.Scope.applicationOverride, "workload", "load.test.clients", 100)
256+
257+
task = self.workload.find_test_procedure_or_default("default").schedule[0]
258+
original_clients = task.clients
259+
260+
d = worker_coordinator.WorkerCoordinator(self.create_test_worker_coordinator_target(), self.cfg,
261+
os_client_factory_class=WorkerCoordinatorTests.StaticClientFactory)
262+
263+
d.prepare_benchmark(t=self.workload)
264+
d.start_benchmark()
265+
266+
# verify the task is modified with the load test client count
267+
self.assertEqual(original_clients, 4)
268+
self.assertEqual(task.clients, 100)
269+
self.assertEqual(task.params["target-throughput"], 100)
270+
253271

254272
def op(name, operation_type):
255273
return workload.Operation(name, operation_type, param_source="worker-coordinator-test-param-source")

0 commit comments

Comments
 (0)