Merge "CreateChangesTriggeringGc: Customize data to execute garbage collection" into stable-3.1
diff --git a/src/test/README.md b/src/test/README.md
index ecb8bfb..23a51b2 100644
--- a/src/test/README.md
+++ b/src/test/README.md
@@ -25,3 +25,22 @@
 scala package one from the scenario classes. The core framework expects
 such a directory structure for both the scala and resources (json data)
 files.
+
+There are two environment properties that can be configured:
+
+The ```minute_multiplier``` property defines a value that get
+multiplied by 60 to represent the time needed by the test before
+creating the last change which triggers the plugin. Its default is ```1```
+and can be set using another value:
+
+```bash
+   -Dcom.ericsson.gerrit.plugins.gcconductor.scenarios.minute_multiplier=5
+```
+
+The ```loose_objects``` property represents the value of loose objects
+required to trigger garbage collection. Its default value is ```400``` and
+can be set using another value:
+
+```bash
+   -Dcom.ericsson.gerrit.plugins.gcconductor.scenarios.loose_objects=50
+```
diff --git a/src/test/scala/com/ericsson/gerrit/plugins/gcconductor/scenarios/CreateChangesTriggeringGc.scala b/src/test/scala/com/ericsson/gerrit/plugins/gcconductor/scenarios/CreateChangesTriggeringGc.scala
index 469677a..c6a4534 100644
--- a/src/test/scala/com/ericsson/gerrit/plugins/gcconductor/scenarios/CreateChangesTriggeringGc.scala
+++ b/src/test/scala/com/ericsson/gerrit/plugins/gcconductor/scenarios/CreateChangesTriggeringGc.scala
@@ -25,17 +25,18 @@
 class CreateChangesTriggeringGc extends ProjectSimulation {
   private val data: FeederBuilder = jsonFile(resource).convert(keys).circular
 
-  lazy val DefaultSecondsToNextEvaluation = 60
-  private lazy val DefaultLooseObjectsToEnqueueGc = 400
+  private lazy val minuteMultiplier = getProperty("minute_multiplier", 1).toInt
+  lazy val secondsToNextEvaluation: Int = 60 * minuteMultiplier
+  private lazy val looseObjectsToEnqueueGc = getProperty("loose_objects", 400).toInt
   private lazy val LooseObjectsPerChange = 2
   private lazy val ChangesMultiplier = 8
   lazy val changesPerSecond: Int = 4 * ChangesMultiplier
   val ChangesForLastEvaluation: Int = single
 
   lazy val secondsForLastEvaluation: Int = SecondsPerWeightUnit
-  private lazy val changesToEnqueueGc = DefaultLooseObjectsToEnqueueGc * ChangesMultiplier / LooseObjectsPerChange
+  private lazy val changesToEnqueueGc = looseObjectsToEnqueueGc * ChangesMultiplier / LooseObjectsPerChange
   lazy val secondsToChanges: Int = changesToEnqueueGc / changesPerSecond
-  private lazy val maxSecondsToEnqueueGc = secondsToChanges + DefaultSecondsToNextEvaluation + secondsForLastEvaluation
+  private lazy val maxSecondsToEnqueueGc = secondsToChanges + secondsToNextEvaluation + secondsForLastEvaluation
 
   override def relativeRuntimeWeight: Int = maxSecondsToEnqueueGc / SecondsPerWeightUnit
 
diff --git a/src/test/scala/com/ericsson/gerrit/plugins/gcconductor/scenarios/CreateChangesTriggeringGcWithProject.scala b/src/test/scala/com/ericsson/gerrit/plugins/gcconductor/scenarios/CreateChangesTriggeringGcWithProject.scala
index 7c1b201..f0859ba 100644
--- a/src/test/scala/com/ericsson/gerrit/plugins/gcconductor/scenarios/CreateChangesTriggeringGcWithProject.scala
+++ b/src/test/scala/com/ericsson/gerrit/plugins/gcconductor/scenarios/CreateChangesTriggeringGcWithProject.scala
@@ -36,7 +36,7 @@
     createChanges.test.inject(
       nothingFor(stepWaitTime(createChanges) seconds),
       constantUsersPerSec(createChanges.changesPerSecond) during (createChanges.secondsToChanges seconds),
-      nothingFor(createChanges.DefaultSecondsToNextEvaluation seconds),
+      nothingFor(createChanges.secondsToNextEvaluation seconds),
       nothingFor(createChanges.secondsForLastEvaluation / 2 seconds),
       atOnceUsers(createChanges.ChangesForLastEvaluation)
     ),