Skip to content

Commit 0fca877

Browse files
committed
loadtest-controller: make TERMINATE a config instead of a topology
1 parent 5544548 commit 0fca877

7 files changed

Lines changed: 13 additions & 25 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ Define multiple test scenarios that run sequentially. Each test case can have th
157157

158158
| Property | Required | Default | Description |
159159
| -------------------------- | -------- | --------- | ---------------------------------------------------------------------------------------------------------- |
160-
| `topology` | **Yes** | - | `N:N`, `N:M`, `TEACHING`, `ONE_SESSION`, or `TERMINATE` |
160+
| `topology` | **Yes** | - | `N:N`, `N:M`, `TEACHING`, or `ONE_SESSION` |
161161
| `participants` | **Yes** | - | List of participant counts (e.g., `["2", "10"]`). Each element of the list will create a new test scenario |
162162
| `sessions` | **Yes** | - | Number of sessions or `infinite` |
163163
| `browser` | No | `chrome` | Browser to use: `chrome` or `firefox` |
@@ -176,7 +176,6 @@ Define multiple test scenarios that run sequentially. Each test case can have th
176176
| `N:M` | N publishers, M subscribers | `"5:50"` |
177177
| `TEACHING` | Publisher with audio-only subscribers | `"2:30"` |
178178
| `ONE_SESSION` | Single session with N participants | `"100"` |
179-
| `TERMINATE` | Terminate all EC2 instances | (none) |
180179

181180
### Workers
182181

@@ -208,6 +207,7 @@ Configuration for where browsers run. Workers can be manually provided and manag
208207
| `availabilityZone` | No | `us-east-1f` | AWS availability zone |
209208
| `workersAtStart` | No | `0` | Number of instances to start the test with |
210209
| `rampUpWorkers` | No | `0` | Workers instances to add when the test runs out of existing ones |
210+
| `terminateWorkers` | No | _true_ | Whether to terminate EC2 instances after test completion |
211211

212212
### Distribution
213213

config/config-all.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ session:
2323

2424
# ---------- Test Cases ----------
2525
# Each test case defines a load test scenario to run sequentially.
26-
# After all test cases complete, the load test ends (or TERMINATE terminates workers).
26+
# After all test cases complete, the load test ends.
2727
testcases:
2828
- topology: N:N
2929
participants:
@@ -58,6 +58,7 @@ aws:
5858
availabilityZone: us-east-1f
5959
workersAtStart: 0
6060
rampUpWorkers: 0
61+
terminateWorkers: true
6162

6263
# ---------- Participant Distribution ----------
6364
distribution:

loadtest-controller/src/main/java/io/openvidu/loadtest/config/LoadTestConfig.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,9 @@ private void initWorkerConfig() {
412412
private void initAwsAndRecordingConfig() {
413413
medianodeLoadForStartRecording = asDouble("recording.mediaNodeLoadThreshold");
414414
recordingSessionGroup = asInt("recording.sessionsGroupSize");
415-
terminateWorkers = asBoolean("terminateWorkers");
415+
// Default terminateWorkers to true when AWS is configured (no worker URLs), false for local workers
416+
Boolean terminateWorkersConfig = asBoolean("terminateWorkers");
417+
terminateWorkers = terminateWorkersConfig != null ? terminateWorkersConfig : workerUrlList.isEmpty();
416418
awsSecretAccessKey = asOptionalString("aws.secretAccessKey");
417419
awsAccessKey = asOptionalString("aws.accessKey");
418420
s3bucketName = asOptionalString("storage.bucket");

loadtest-controller/src/main/java/io/openvidu/loadtest/models/testcase/TestCase.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,6 @@ public boolean isOneSession() {
6262
return this.topology.getValue().equals(Topology.ONE_SESSION.getValue());
6363
}
6464

65-
public boolean isTerminate() {
66-
return this.topology.getValue().equals(Topology.TERMINATE.getValue());
67-
}
68-
6965
public Topology getTopology() {
7066
return topology;
7167
}

loadtest-controller/src/main/java/io/openvidu/loadtest/models/testcase/Topology.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ public enum Topology {
88

99
TEACHING("TEACHING", "TEACHING"),
1010

11-
ONE_SESSION("ONE_SESSION", "One session with N publishers or X:M subscribers"),
12-
13-
TERMINATE("TERMINATE", "Terminate all Ec2 instances launched");
11+
ONE_SESSION("ONE_SESSION", "One session with N publishers or X:M subscribers");
1412

1513
private String value;
1614
private String description;

loadtest-controller/src/main/java/io/openvidu/loadtest/services/core/LoadTestTopologyOrchestrator.java

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,6 @@ private interface TestInvocation {
3636

3737
void startLoadTests(List<TestCase> testCasesList) {
3838

39-
if (loadTestConfig.isTerminateWorkers()) {
40-
log.info("Terminate all EC2 instances");
41-
loadTestService.terminateAllInstances();
42-
return;
43-
}
44-
4539
kibanaClient.importDashboards();
4640

4741
if (!loadTestService.hasInitialWorkersAvailable()) {
@@ -50,6 +44,11 @@ void startLoadTests(List<TestCase> testCasesList) {
5044
}
5145

5246
testCasesList.forEach(this::runTestCase);
47+
48+
if (loadTestConfig.isTerminateWorkers()) {
49+
log.info("Terminate all EC2 instances");
50+
loadTestService.terminateAllInstances();
51+
}
5352
}
5453

5554
private void runTestCase(TestCase testCase) {
@@ -59,9 +58,6 @@ private void runTestCase(TestCase testCase) {
5958
runNxMCase(testCase);
6059
} else if (testCase.isOneSession()) {
6160
runOneSessionCase(testCase);
62-
} else if (testCase.isTerminate() && loadTestService.isProdMode()) {
63-
log.info("TERMINATE topology. Terminate all EC2 instances");
64-
loadTestService.terminateAllInstances();
6561
} else {
6662
log.error("Test case has wrong topology, SKIPPED.");
6763
}

loadtest-controller/src/main/java/io/openvidu/loadtest/utils/DataIO.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,6 @@ private List<TestCase> convertMapListToTestCasesList(List<Map<String, Object>> t
128128
private TestCase parseTestCase(Map<String, Object> element) {
129129
String topology = parseTopology(element);
130130

131-
if (topology.equalsIgnoreCase(Topology.TERMINATE.getValue())) {
132-
return new TestCase(topology, new ArrayList<>(), 0, 30, Resolution.MEDIUM,
133-
OpenViduRecordingMode.NONE, false, false, true, Browser.CHROME);
134-
}
135-
136131
List<String> participants = parseParticipants(element);
137132
int sessions = parseSessions(element);
138133
int frameRate = parseFrameRate(element);

0 commit comments

Comments
 (0)