Make number of initially created projects configurable
Change-Id: Ic3d810070a2ee96165d37c236f4f5cb1deaca2c1
diff --git a/README.md b/README.md
index d057f14..2d026f0 100644
--- a/README.md
+++ b/README.md
@@ -44,13 +44,15 @@
The single configuration values are listed here:
-| key | description | default value |
-|--------------------|---------------------------------------------------------------------------------------|-------------------------|
-| `gerrit.url` | URL of the Gerrit test server | `http://localhost:8080` |
-| `gerrit.user` | Gerrit user used for tests | `admin` |
-| `gerrit.password` | Password of Gerrit user | `secret` |
-| `testrun.duration` | Duration for which to run the tests | `null` (indefinitely) |
-| `actions.*` | Probability with which an action is performed in each cycle (`0`: never, `1`: always) | `1` |
+| key | description | default value |
+|-------------------------------------------------|---------------------------------------------------------------------------------------|-------------------------|
+| `gerrit.url` | URL of the Gerrit test server | `http://localhost:8080` |
+| `gerrit.user` | Gerrit user used for tests | `admin` |
+| `gerrit.password` | Password of Gerrit user | `secret` |
+| `testrun.duration` | Duration for which to run the tests | `null` (indefinitely) |
+| `testrun.initialization.createProjects.enabled` | Whether to create new projects during initialization | `true` |
+| `testrun.initialization.createProjects.number` | How many new projects to create during initialization | `1` |
+| `actions.*` | Probability with which an action is performed in each cycle (`0`: never, `1`: always) | `1` |
### Available actions
diff --git a/config.sample.yaml b/config.sample.yaml
index 0e6f34b..bdec749 100644
--- a/config.sample.yaml
+++ b/config.sample.yaml
@@ -5,6 +5,10 @@
testrun:
duration: null
+ initialization:
+ createProjects:
+ enabled: true
+ number: 1
actions:
clone_project:
diff --git a/container/tools/config/parser.py b/container/tools/config/parser.py
index b55bf08..c7e45fc 100644
--- a/container/tools/config/parser.py
+++ b/container/tools/config/parser.py
@@ -20,7 +20,10 @@
DEFAULTS = {
"gerrit": {"url": None, "user": "admin", "password": "secret"},
- "testrun": {"duration": None},
+ "testrun": {
+ "duration": None,
+ "initialization": {"createProjects": {"enabled": True, "number": 1}},
+ },
"actions": {
"clone_project": {"probability": 1},
"create_project": {"probability": 1},
diff --git a/container/tools/start_test.py b/container/tools/start_test.py
index 39ac5f6..d1fe684 100755
--- a/container/tools/start_test.py
+++ b/container/tools/start_test.py
@@ -45,7 +45,10 @@
self.owned_projects = set()
self.cloned_projects = set()
- self._create_initial_projects(1)
+ if test_config["testrun"]["initialization"]["createProjects"]["enabled"]:
+ self._create_initial_projects(
+ test_config["testrun"]["initialization"]["createProjects"]["number"]
+ )
self.log = logging.getLogger("ActionLogger")