USERGRID-871: new custom injection test plus loading no-name entities
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/d3174e6d Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/d3174e6d Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/d3174e6d Branch: refs/heads/two-dot-o-dev Commit: d3174e6d7474e6d257cbe66ef996bf76b3ea86af Parents: 211fe1a Author: Mike Dunker <mikedun...@calbears.net> Authored: Tue Aug 11 17:03:24 2015 -0700 Committer: Mike Dunker <mikedun...@calbears.net> Committed: Tue Aug 11 17:03:24 2015 -0700 ---------------------------------------------------------------------- .../runCustomInjectRandomEntityByUuidTest.sh | 107 +++++++++++++++++++ stack/loadtests/runLoadNoNameEntities.sh | 97 +++++++++++++++++ .../datagenerators/FeederGenerator.scala | 9 +- .../usergrid/enums/ConfigProperties.scala | 4 +- .../usergrid/enums/EndConditionType.scala | 3 +- .../usergrid/scenarios/AuditScenarios.scala | 6 +- .../org/apache/usergrid/settings/Settings.scala | 2 +- .../simulations/ConfigurableSimulation.scala | 6 ++ .../simulations/CustomInjectionSimulation.scala | 107 +++++++++++++++++++ stack/loadtests/testConfig.sh | 6 +- 10 files changed, 335 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/d3174e6d/stack/loadtests/runCustomInjectRandomEntityByUuidTest.sh ---------------------------------------------------------------------- diff --git a/stack/loadtests/runCustomInjectRandomEntityByUuidTest.sh b/stack/loadtests/runCustomInjectRandomEntityByUuidTest.sh new file mode 100755 index 0000000..3164a9d --- /dev/null +++ b/stack/loadtests/runCustomInjectRandomEntityByUuidTest.sh @@ -0,0 +1,107 @@ +#!/bin/bash +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# +# Injection list: +# type(arg1,arg2,...);type(arg1,...) +# +# types: +# rampUsers(int numUsers, int overSeconds) +# constantUsersPerSec(double numUsersPerSec, int duringSeconds) +# constantUsersPerSecRandomized(double numUsersPerSec, int duringSeconds) +# atOnceUsers(int numUsers) +# rampUsersPerSec(double numUsersPerSec, int totalUsers, int duringSeconds) +# rampUsersPerSecRandomized(double numUsersPerSec, int totalUsers, int duringSeconds) +# heavisideUsers(int numUsers, int overSeconds) +# nothingFor(int seconds) +# +# Example: rampUsers(30,120);nothingFor(120);atOnceUsers(20) + +DIR="${BASH_SOURCE%/*}" +if [[ ! -d "$DIR" ]]; then DIR="$PWD"; fi +. "$DIR/testConfig.sh" + +# from testConfig.sh +#URL= +#ADMIN_USER= +#ADMIN_PASSWORD= +#ORG= +#APP= +#AUTH_TYPE= +#TOKEN_TYPE= +#CREATE_ORG= +#CREATE_APP= +#LOAD_ENTITIES= +#SANDBOX_COLLECTION= +#NUM_ENTITIES= +#SKIP_SETUP= +#COLLECTION= +#RETRY_COUNT= +#END_CONDITION_TYPE= +#END_MINUTES= +#END_REQUEST_COUNT= +#INJECTION_LIST= + +helpMsg() { + echo "At least 2 arguments required, $# provided. Example is $0 INJECTION_LIST UUID_FILENAME" 1>&2 + echo "Injection types:" 1>&2 + echo " rampUsers(int numUsers, int overSeconds)" 1>&2 + echo " constantUsersPerSec(double numUsersPerSec, int duringSeconds)" 1>&2 + echo " constantUsersPerSecRandomized(double numUsersPerSec, int duringSeconds)" 1>&2 + echo " atOnceUsers(int numUsers)" 1>&2 + echo " rampUsersPerSec(double numUsersPerSec, int totalUsers, int duringSeconds)" 1>&2 + echo " rampUsersPerSecRandomized(double numUsersPerSec, int totalUsers, int duringSeconds)" 1>&2 + echo " heavisideUsers(int numUsers, int overSeconds)" 1>&2 + echo " nothingFor(int seconds)" 1>&2 + exit 1 +} + +[ "$#" -ge 2 ] || helpMsg + +INJECTION_LIST="$1" +UUID_FILENAME="$2" + +shift 2 + +SCENARIO_TYPE=uuidRandomInfinite + +#Compile everything +mvn compile + +#Execute the test +mvn gatling:execute \ +-DbaseUrl=${URL} \ +-DadminUser=${ADMIN_USER} \ +-DadminPassword=${ADMIN_PASSWORD} \ +-Dorg=${ORG} \ +-Dapp=${APP} \ +-DauthType=${AUTH_TYPE} \ +-DtokenType=${TOKEN_TYPE} \ +-DcreateOrg=${CREATE_ORG} \ +-DcreateApp=${CREATE_APP} \ +-DloadEntities=${LOAD_ENTITIES} \ +-DsandboxCollection=${SANDBOX_COLLECTION} \ +-DnumEntities=${NUM_ENTITIES} \ +-DskipSetup=${SKIP_SETUP} \ +-Dcollection=${COLLECTION} \ +-DretryCount=${RETRY_COUNT} \ +-DendConditionType=${END_CONDITION_TYPE} \ +-DendMinutes=${END_MINUTES} \ +-DendRequestCount=${END_REQUEST_COUNT} \ +-DscenarioType=${SCENARIO_TYPE} \ +-DuuidFilename=${UUID_FILENAME} \ +-DinjectionList=${INJECTION_LIST} \ +-Dgatling.simulationClass=org.apache.usergrid.simulations.CustomInjectionSimulation + http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/d3174e6d/stack/loadtests/runLoadNoNameEntities.sh ---------------------------------------------------------------------- diff --git a/stack/loadtests/runLoadNoNameEntities.sh b/stack/loadtests/runLoadNoNameEntities.sh new file mode 100755 index 0000000..4acf1cc --- /dev/null +++ b/stack/loadtests/runLoadNoNameEntities.sh @@ -0,0 +1,97 @@ +#!/bin/bash +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +DIR="${BASH_SOURCE%/*}" +if [[ ! -d "$DIR" ]]; then DIR="$PWD"; fi +. "$DIR/testConfig.sh" + +# from testConfig.sh +#URL= +#ADMIN_USER= +#ADMIN_PASSWORD= +#ENTITY_WORKER_NUM= #may be overridden on command line +#ENTITY_WORKER_COUNT= #may be overridden on command line +#ORG= +#APP= +#AUTH_TYPE= +#TOKEN_TYPE= +#CREATE_ORG= +#CREATE_APP= +#SANDBOX_COLLECTION= +#NUM_ENTITIES= #may be overridden on command line +#SKIP_SETUP= +#ENTITY_SEED= #may be overridden on command line +#RETRY_COUNT= +#ENTITY_PROGRESS_COUNT= +#CONSTANT_USERS_PER_SEC= +#CONSTANT_USERS_DURATION= + + +die() { echo "$@" 1>&2 ; exit 1; } + +[ "$#" -ge 2 ] || die "At least 2 arguments required, $# provided. Example is $0 RAMP_USERS RAMP_TIME(seconds) [UUID_FILENAME [NUM_ENTITIES [ENTITY_SEED [ENTITY_WORKER_NUM [ENTITY_WORKER_COUNT]]]]]" + +RAMP_USERS="$1" +RAMP_TIME="$2" +[ "$#" -ge 3 ] && UUID_FILENAME="$3" +[ "$#" -ge 4 ] && NUM_ENTITIES="$4" +[ "$#" -ge 5 ] && ENTITY_SEED="$5" +[ "$#" -ge 6 ] && ENTITY_WORKER_NUM="$6" +[ "$#" -ge 7 ] && ENTITY_WORKER_COUNT="$7" + +shift $# + +SCENARIO_TYPE=loadEntities +ENTITY_TYPE=trivialSortable +ENTITY_PREFIX="" +COLLECTION=nonames + +# don't load entities as part of setup (loading entities is the point of the test) +LOAD_ENTITIES=false + +#Compile everything +mvn compile + +#Execute the test +mvn gatling:execute \ +-DbaseUrl=${URL} \ +-DadminUser=${ADMIN_USER} \ +-DadminPassword=${ADMIN_PASSWORD} \ +-DentityWorkerNum=${ENTITY_WORKER_NUM} \ +-DentityWorkerCount=${ENTITY_WORKER_COUNT} \ +-Dorg=${ORG} \ +-Dapp=${APP} \ +-DauthType=${AUTH_TYPE} \ +-DtokenType=${TOKEN_TYPE} \ +-DcreateOrg=${CREATE_ORG} \ +-DcreateApp=${CREATE_APP} \ +-DsandboxCollection=${SANDBOX_COLLECTION} \ +-DnumEntities=${NUM_ENTITIES} \ +-DskipSetup=${SKIP_SETUP} \ +-Dcollection=${COLLECTION} \ +-DentitySeed=${ENTITY_SEED} \ +-DretryCount=${RETRY_COUNT} \ +-DentityProgressCount=${ENTITY_PROGRESS_COUNT} \ +-DconstantUsersPerSec=${CONSTANT_USERS_PER_SEC} \ +-DconstantUsersDuration=${CONSTANT_USERS_DURATION} \ +-DscenarioType=${SCENARIO_TYPE} \ +-DentityType=${ENTITY_TYPE} \ +-DentityPrefix=${ENTITY_PREFIX} \ +-DloadEntities=${LOAD_ENTITIES} \ +-DrampUsers=${RAMP_USERS} \ +-DrampTime=${RAMP_TIME} \ +-DuuidFilename=${UUID_FILENAME} \ +-Dgatling.simulationClass=org.apache.usergrid.simulations.ConfigurableSimulation + http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/d3174e6d/stack/loadtests/src/main/scala/org/apache/usergrid/datagenerators/FeederGenerator.scala ---------------------------------------------------------------------- diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/datagenerators/FeederGenerator.scala b/stack/loadtests/src/main/scala/org/apache/usergrid/datagenerators/FeederGenerator.scala index 55c0bfe..9546e2d 100755 --- a/stack/loadtests/src/main/scala/org/apache/usergrid/datagenerators/FeederGenerator.scala +++ b/stack/loadtests/src/main/scala/org/apache/usergrid/datagenerators/FeederGenerator.scala @@ -211,7 +211,7 @@ object FeederGenerator { * This feeder will serve data forever, but validEntity will be set to "no" when data has run out. Each user can * then exit in a controlled fashion. */ - def generateCustomEntityFeeder(numEntities: Int, entityType: String, prefix: String, seed: Int = 1): Feeder[String] = + def generateCustomEntityFeeder(numEntities: Int, entityType: String, prefix: String = "", seed: Int = 1): Feeder[String] = new Feeder[String] { var counter = new AtomicInteger(0) @@ -221,8 +221,9 @@ object FeederGenerator { override def next(): Map[String, String] = { val i = counter.getAndIncrement() val seededVal = i + seed - val entityName = prefix.concat(seededVal.toString) - val entity = EntityDataGenerator.generateEntity(entityType, entityName) + val noPrefix = prefix == null || prefix == "" + val entityName = if (noPrefix) seededVal.toString else prefix.concat(seededVal.toString) + val entity = EntityDataGenerator.generateEntity(entityType, if (noPrefix) null else entityName) val entityUrl = Settings.baseCollectionUrl + "/" + entityName val validEntity = if (i >= numEntities) "no" else "yes" @@ -282,7 +283,7 @@ object FeederGenerator { } def generateCustomEntityInfiniteFeeder(seed: Int = Settings.entitySeed, entityType: String = Settings.entityType, prefix: String = Settings.entityPrefix): Iterator[String] = { - Iterator.from(seed).map(i=>EntityDataGenerator.generateEntity(entityType, prefix.concat(i.toString))) + Iterator.from(seed).map(i=>EntityDataGenerator.generateEntity(entityType, if (prefix == null || prefix == "") null else prefix.concat(i.toString))) } } http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/d3174e6d/stack/loadtests/src/main/scala/org/apache/usergrid/enums/ConfigProperties.scala ---------------------------------------------------------------------- diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/enums/ConfigProperties.scala b/stack/loadtests/src/main/scala/org/apache/usergrid/enums/ConfigProperties.scala index 03581ba..230f58b 100644 --- a/stack/loadtests/src/main/scala/org/apache/usergrid/enums/ConfigProperties.scala +++ b/stack/loadtests/src/main/scala/org/apache/usergrid/enums/ConfigProperties.scala @@ -74,6 +74,7 @@ object ConfigProperties { val RetryCount = "retryCount" val LaterThanTimestamp = "laterThanTimestamp" val EntityProgressCount = "entityProgressCount" + val InjectionList = "injectionList" val Values = Seq(Org,App,AdminUser,AdminPassword,BaseUrl,AuthType,TokenType,SkipSetup,CreateOrg,CreateApp,LoadEntities, ScenarioType,RampUsers,ConstantUsersPerSec,ConstantUsersDuration,UserSeed,AppUser,AppUserPassword,NumEntities, @@ -81,7 +82,7 @@ object ConfigProperties { EntityType,EntitySeed,SearchLimit,SearchQuery,EndConditionType,EndMinutes,EndRequestCount,OrgCreationUsername, OrgCreationName,OrgCreationEmail,OrgCreationPassword,UpdateProperty,UpdateValue,EntityWorkerCount,EntityWorkerNum, UuidFilename,AuditUuidFilename,FailedUuidFilename,SandboxCollection,PurgeUsers,RetryCount,LaterThanTimestamp, - EntityProgressCount) + EntityProgressCount,InjectionList) def isValid(str: String): Boolean = { Values.contains(str) @@ -143,6 +144,7 @@ object ConfigProperties { case RetryCount => 5 case LaterThanTimestamp => 0L case EntityProgressCount => 10000L + case InjectionList => "rampUsers(10,60)" } } else { null http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/d3174e6d/stack/loadtests/src/main/scala/org/apache/usergrid/enums/EndConditionType.scala ---------------------------------------------------------------------- diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/enums/EndConditionType.scala b/stack/loadtests/src/main/scala/org/apache/usergrid/enums/EndConditionType.scala index 6d77dd1..5dd78ad 100644 --- a/stack/loadtests/src/main/scala/org/apache/usergrid/enums/EndConditionType.scala +++ b/stack/loadtests/src/main/scala/org/apache/usergrid/enums/EndConditionType.scala @@ -19,8 +19,9 @@ package org.apache.usergrid.enums object EndConditionType { val MinutesElapsed = "minutesElapsed" val RequestCount = "requestCount" + val Unlimited = "unlimited" - val Values = Seq(MinutesElapsed,RequestCount) + val Values = Seq(MinutesElapsed,RequestCount,Unlimited) def isValid(str: String): Boolean = { Values.contains(str) http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/d3174e6d/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/AuditScenarios.scala ---------------------------------------------------------------------- diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/AuditScenarios.scala b/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/AuditScenarios.scala index cdaa89b..b3d19b4 100644 --- a/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/AuditScenarios.scala +++ b/stack/loadtests/src/main/scala/org/apache/usergrid/scenarios/AuditScenarios.scala @@ -121,13 +121,13 @@ object AuditScenarios { if (count < 1) { Settings.addAuditUuid(uuid, collectionName, entityName, modified) Settings.incAuditNotFound() - println(s"NOT FOUND: $collectionName.$entityName $uuid") + println(s"NOT FOUND: $collectionName.$entityName ($uuid)") } else if (count > 1) { Settings.addAuditUuid(uuid, collectionName, entityName, modified) Settings.incAuditBadResponse() - println(s"INVALID RESPONSE (count=$count): $collectionName.$entityName $uuid") + println(s"INVALID RESPONSE (count=$count): $collectionName.$entityName ($uuid)") } else { - // println(s"FOUND: $collectionName.$entityName $uuid") + // println(s"FOUND: $collectionName.$entityName ($uuid)") Settings.incAuditSuccess() } http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/d3174e6d/stack/loadtests/src/main/scala/org/apache/usergrid/settings/Settings.scala ---------------------------------------------------------------------- diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/settings/Settings.scala b/stack/loadtests/src/main/scala/org/apache/usergrid/settings/Settings.scala index 08e1ae2..6c226d5 100755 --- a/stack/loadtests/src/main/scala/org/apache/usergrid/settings/Settings.scala +++ b/stack/loadtests/src/main/scala/org/apache/usergrid/settings/Settings.scala @@ -128,7 +128,6 @@ object Settings { val overallEntitySeed = initIntSetting(ConfigProperties.EntitySeed) val searchLimit:Int = initIntSetting(ConfigProperties.SearchLimit) val searchQuery = initStrSetting(ConfigProperties.SearchQuery) - println(s"searchQuery=${searchQuery}") val endConditionType = initStrSetting(ConfigProperties.EndConditionType) val endMinutes:Int = initIntSetting(ConfigProperties.EndMinutes) val endRequestCount:Int = initIntSetting(ConfigProperties.EndRequestCount) @@ -146,6 +145,7 @@ object Settings { val laterThanTimestamp:Long = initLongSetting(ConfigProperties.LaterThanTimestamp) val entityProgressCount:Long = initLongSetting(ConfigProperties.EntityProgressCount) private val logEntityProgress: Boolean = entityProgressCount > 0L + val injectionList = initStrSetting(ConfigProperties.InjectionList) // Entity update val updateProperty = initStrSetting(ConfigProperties.UpdateProperty) http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/d3174e6d/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/ConfigurableSimulation.scala ---------------------------------------------------------------------- diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/ConfigurableSimulation.scala b/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/ConfigurableSimulation.scala index ac4cfd4..66aaac0 100755 --- a/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/ConfigurableSimulation.scala +++ b/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/ConfigurableSimulation.scala @@ -89,10 +89,16 @@ class ConfigurableSimulation extends Simulation { } after { + endHandler + } + + def endHandler: Unit = { Settings.setTestEndTime() if (Settings.captureUuids) Settings.writeUuidsToFile() Settings.printSettingsSummary(true) } + sys addShutdownHook(endHandler) + } http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/d3174e6d/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/CustomInjectionSimulation.scala ---------------------------------------------------------------------- diff --git a/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/CustomInjectionSimulation.scala b/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/CustomInjectionSimulation.scala new file mode 100755 index 0000000..9d27173 --- /dev/null +++ b/stack/loadtests/src/main/scala/org/apache/usergrid/simulations/CustomInjectionSimulation.scala @@ -0,0 +1,107 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.usergrid.simulations + +import io.gatling.core.Predef._ +import io.gatling.core.controller.inject.InjectionStep +import io.gatling.core.structure.ScenarioBuilder +import org.apache.usergrid.enums.ScenarioType +import org.apache.usergrid.helpers.Setup +import org.apache.usergrid.scenarios.EntityCollectionScenarios +import org.apache.usergrid.settings.Settings + +import scala.collection.mutable + +/** + * Simulations with custom injection. + */ +class CustomInjectionSimulation extends Simulation { + + def getScenario(scenarioType: String): ScenarioBuilder = { + scenarioType match { + case ScenarioType.LoadEntities => EntityCollectionScenarios.loadEntities + case ScenarioType.DeleteEntities => EntityCollectionScenarios.deleteEntities + case ScenarioType.UpdateEntities => EntityCollectionScenarios.updateEntities + case ScenarioType.GetAllByCursor => EntityCollectionScenarios.getEntityPagesToEnd + case ScenarioType.NameRandomInfinite => EntityCollectionScenarios.getRandomEntitiesByName + case ScenarioType.UuidRandomInfinite => EntityCollectionScenarios.getRandomEntitiesByUuid + case ScenarioType.GetByNameSequential => EntityCollectionScenarios.getEntitiesByNameSequential + case _ => null + } + } + + before{ + if (!Settings.skipSetup) { + println("Begin setup") + if (Settings.createOrg) Setup.setupOrg() + if (Settings.createApp) Setup.setupApplication() + if (Settings.loadEntities) Setup.setupEntitiesCollection(Settings.numEntities, Settings.entityType, Settings.entityPrefix, Settings.entitySeed) + } else { + println("Skipping setup") + } + if (Settings.sandboxCollection) Setup.sandboxCollection() + Settings.setTestStartTime() + } + + if (ScenarioType.isValid(Settings.scenarioType)) { + val scenario: ScenarioBuilder = getScenario(Settings.scenarioType) + + val injectionList:String = Settings.injectionList + val injectStepsArray:Array[String] = injectionList.split("\\s*;\\s*") + val injectStepList:mutable.ArraySeq[InjectionStep] = new mutable.ArraySeq[InjectionStep](injectStepsArray.length) + for (i <- injectStepsArray.indices) { + val injectionStep = injectStepsArray(i).trim + println(injectionStep) + val stepRegex = """(.+)\((.*)\)""".r + val stepRegex(stepType,stepArgsStr) = injectionStep + println(s"stepType:$stepType stepArgs:$stepArgsStr") + val stepArgs = stepArgsStr.split("\\s*,\\s*") + injectStepList(i) = stepType match { + case "rampUsers" => rampUsers(stepArgs(0).toInt) over stepArgs(1).toInt + case "constantUsersPerSec" => constantUsersPerSec(stepArgs(0).toDouble) during stepArgs(1).toInt + case "constantUsersPerSecRandomized" => constantUsersPerSec(stepArgs(0).toDouble) during stepArgs(1).toInt randomized + case "atOnceUsers" => atOnceUsers(stepArgs(0).toInt) + case "rampUsersPerSec" => rampUsersPerSec(stepArgs(0).toDouble) to stepArgs(1).toInt during stepArgs(2).toInt + case "rampUsersPerSecRandomized" => rampUsersPerSec(stepArgs(0).toDouble) to stepArgs(1).toInt during stepArgs(2).toInt randomized + case "heavisideUsers" => heavisideUsers(stepArgs(0).toInt) over stepArgs(1).toInt + case "nothingFor" => nothingFor(stepArgs(0).toInt) + } + } + + setUp( + scenario + .inject(injectStepList) + .protocols(Settings.httpConf.acceptHeader("application/json")) + ) + } else { + println(s"scenarioType ${Settings.scenarioType} not found.") + } + + after { + endHandler + } + + def endHandler: Unit = { + Settings.setTestEndTime() + if (Settings.captureUuids) Settings.writeUuidsToFile() + Settings.printSettingsSummary(true) + } + + sys addShutdownHook(endHandler) + +} + http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/d3174e6d/stack/loadtests/testConfig.sh ---------------------------------------------------------------------- diff --git a/stack/loadtests/testConfig.sh b/stack/loadtests/testConfig.sh index 1e20637..0901e99 100755 --- a/stack/loadtests/testConfig.sh +++ b/stack/loadtests/testConfig.sh @@ -37,7 +37,7 @@ SANDBOX_COLLECTION=true NUM_ENTITIES=10000 SKIP_SETUP=false -COLLECTION=thousand +COLLECTION=thousands ENTITY_TYPE=trivialSortable ENTITY_PREFIX=sortable ENTITY_SEED=1 @@ -50,8 +50,10 @@ ENTITY_PROGRESS_COUNT=1000 END_CONDITION_TYPE=minutesElapsed #END_CONDITION_TYPE=requestCount -END_MINUTES=2 +END_MINUTES=5 END_REQUEST_COUNT=100 CONSTANT_USERS_PER_SEC=0 CONSTANT_USERS_DURATION=10 + +INJECTION_LIST="rampUsers(100,300);nothingFor(300)"