100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps
Java asset-managementbuildingdashboarddataplatformdevice-managementedge-computingenergyenergy-managementenergy-monitorfleet-managementfleet-telematicsiotiot-applicationiot-platformmodbusmqttmqtt-brokerota-updaterules-enginesmartcity
Allow disconnect delay on connect-and-publish test (#2343)
Eric Bariaux871b261f298e
diff --git a/test/load2-eks/README.md b/test/load2-eks/README.mdindex fd9a05162..7ed88c0cc 100644--- a/test/load2-eks/README.md+++ b/test/load2-eks/README.md@@ -41,15 +41,17 @@ Two scenarios are provided:#### connect-and-publishRuns for a given duration, publishing attribute value changes over MQTT once connected.-For each connection, it publishes ASSETS_COUNT values at the same time (50ms interval), then pauses for MILLIS_BETWEEN_PUBLISHES.+For each connection, it publishes ASSETS_COUNT values at the same time (50ms interval), then pauses for MILLIS_BETWEEN_PUBLISHES.+At the end of publish loop, it waits for DISCONNECT_DELAY before disconnecting from MQTT.The parameters are:-MANAGER_HOSTNAME: Hostname of the manager to be tested-THREAD_COUNT: Number of parallel accounts that will connect and publish in parallel-ASSETS_COUNT: Number of Light assets for which to publish an attribute during each iteration-RAMP_RATE: Number of thread to add per second during ramp-up-DURATION: Total duration to run the test for-MILLIS_BETWEEN_PUBLISHES: Delay between each publishing iteration+MANAGER_HOSTNAME: Hostname of the manager to be tested. Default is localhost.+THREAD_COUNT: Number of parallel accounts that will connect and publish in parallel. Default is 500.+ASSETS_COUNT: Number of Light assets for which to publish an attribute during each iteration. Default is 5.+RAMP_RATE: Number of thread to add per second during ramp-up. Default is 20.+DURATION: Total duration to run the test for, in seconds. Default is 300.+MILLIS_BETWEEN_PUBLISHES: Delay between each publishing iteration. Default is 1000.+DISCONNECT_DELAY: Delay before closing the MQTT connection after publishing loop, in seconds. Default is 0.#### connect-settle-test@@ -58,7 +60,7 @@ Once connected, it does 1 single publish every MILLIS_BETWEEN_PUBLISHES (defaultGoal is to measure the time it takes for the system to allow that many connections and stabilise.The parameters are:-MANAGER_HOSTNAME: Hostname of the manager to be tested-THREAD_COUNT: Number of parallel accounts that will connect publish in parallel-RAMP_RATE: Number of thread to add per second during ramp-up-MILLIS_BETWEEN_PUBLISHES: Delay between each publishing iteration+MANAGER_HOSTNAME: Hostname of the manager to be tested. Default is localhost.+THREAD_COUNT: Number of parallel accounts that will connect and publish in parallel. Default is 1000.+RAMP_RATE: Number of thread to add per second during ramp-up. Default is 50.+MILLIS_BETWEEN_PUBLISHES: Delay between each publishing iteration. Default is 30000.diff --git a/test/load2-eks/scenarios/connect-and-publish.jmx b/test/load2-eks/scenarios/connect-and-publish.jmxindex e7a444609..4c26ab1a5 100644--- a/test/load2-eks/scenarios/connect-and-publish.jmx+++ b/test/load2-eks/scenarios/connect-and-publish.jmx@@ -27,13 +27,13 @@</elementProp></SetupThreadGroup><hashTree>- <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="Setup" enabled="true">+ <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="Setup"><stringProp name="scriptLanguage">groovy</stringProp><stringProp name="parameters"></stringProp><stringProp name="filename"></stringProp><stringProp name="cacheKey">true</stringProp><stringProp name="script">// Store thread count-def threadCount = props.get("THREAD_COUNT") ?: "1000"+def threadCount = props.get("THREAD_COUNT") ?: "500"if (threadCount instanceof String) {threadCount = Integer.parseInt(threadCount)}@@ -51,19 +51,18 @@ props.put("successes", new java.util.concurrent.atomic.AtomicInteger(0</hashTree><ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="mqtt-client-auto-provision-pub" enabled="true"><boolProp name="ThreadGroup.delayedStart">true</boolProp>- <stringProp name="ThreadGroup.num_threads">${__groovy(props.get("THREAD_COUNT") ?: "1000",)}</stringProp>- <stringProp name="ThreadGroup.ramp_time">${__groovy(Math.max(1\,(int)((props.get("THREAD_COUNT") ?: "1000").toInteger() / (props.get("RAMP_RATE") ?: "50").toInteger())),)}</stringProp>- <stringProp name="ThreadGroup.duration">${__groovy(props.get("DURATION") ?: "300",)}</stringProp>+ <stringProp name="ThreadGroup.num_threads">${__groovy(props.get("THREAD_COUNT") ?: "500",)}</stringProp>+ <stringProp name="ThreadGroup.ramp_time">${__groovy(Math.max(1\,(int)((props.get("THREAD_COUNT") ?: "500").toInteger() / (props.get("RAMP_RATE") ?: "20").toInteger())),)}</stringProp>+ <stringProp name="ThreadGroup.duration">${__groovy(props.get("DURATION") ?: "300")}</stringProp><boolProp name="ThreadGroup.same_user_on_next_iteration">true</boolProp>- <boolProp name="ThreadGroup.scheduler">true</boolProp><stringProp name="ThreadGroup.on_sample_error">startnextloop</stringProp><elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController">- <intProp name="LoopController.loops">-1</intProp>+ <stringProp name="LoopController.loops">1</stringProp><boolProp name="LoopController.continue_forever">false</boolProp></elementProp></ThreadGroup><hashTree>- <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="Compute assetId">+ <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="Compute assetId" enabled="true"><stringProp name="scriptLanguage">groovy</stringProp><stringProp name="parameters"></stringProp><stringProp name="filename"></stringProp>@@ -83,7 +82,20 @@ vars.put("assetId_matchNr", count.toString())</stringProp></JSR223Sampler><hashTree/>- <net.xmeter.samplers.ConnectSampler guiclass="net.xmeter.gui.ConnectSamplerUI" testclass="net.xmeter.samplers.ConnectSampler" testname="connect">+ <JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="Record start time" enabled="true">+ <stringProp name="scriptLanguage">groovy</stringProp>+ <stringProp name="parameters"></stringProp>+ <stringProp name="filename"></stringProp>+ <stringProp name="cacheKey">true</stringProp>+ <stringProp name="script">// Record when this thread started+vars.putObject("threadStartTime", System.currentTimeMillis())+def duration = (props.get("DURATION") ?: "300").toString().toInteger()+vars.put("testDuration", duration.toString())+log.info(">>> Thread ${ctx.getThreadNum()} started, will run for ${duration} seconds")+</stringProp>+ </JSR223Sampler>+ <hashTree/>+ <net.xmeter.samplers.ConnectSampler guiclass="net.xmeter.gui.ConnectSamplerUI" testclass="net.xmeter.samplers.ConnectSampler" testname="connect" enabled="true"><stringProp name="mqtt.server">${__P(MANAGER_HOSTNAME,localhost)}</stringProp><stringProp name="mqtt.port">8883</stringProp><stringProp name="mqtt.version">3.1</stringProp>@@ -149,10 +161,18 @@ return delay</stringProp></ConstantTimer><hashTree/></hashTree>- <LoopController guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller">- <boolProp name="LoopController.continue_forever">true</boolProp>- <intProp name="LoopController.loops">-1</intProp>- </LoopController>+ <WhileController guiclass="WhileControllerGui" testclass="WhileController" testname="While Controller">+ <stringProp name="WhileController.condition">${__groovy(+ def startTime = vars.getObject("threadStartTime");+ if (startTime == null) {+ false+ } else {+ def elapsed = (System.currentTimeMillis() - vars.getObject("threadStartTime")) / 1000;+ def duration = (vars.get("testDuration") ?: "300").toInteger()+ elapsed < duration;+ }+ )}</stringProp>+ </WhileController><hashTree><JSR223Sampler guiclass="TestBeanGUI" testclass="JSR223Sampler" testname="JSR223 Sampler"><stringProp name="scriptLanguage">groovy</stringProp>@@ -162,7 +182,7 @@ return delay</stringProp><stringProp name="script">log.info(">>> Will push " + vars.get("assetId_matchNr") + " attribute updates")</stringProp></JSR223Sampler><hashTree>- <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="Constant Timer">+ <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="Constant Timer" enabled="true"><stringProp name="ConstantTimer.delay">${__P(MILLIS_BETWEEN_PUBLISHES,1000)}</stringProp></ConstantTimer><hashTree/>@@ -173,7 +193,7 @@ return delay</stringProp><boolProp name="ForeachController.useSeparator">true</boolProp></ForeachController><hashTree>- <net.xmeter.samplers.PubSampler guiclass="net.xmeter.gui.PubSamplerUI" testclass="net.xmeter.samplers.PubSampler" testname="Publish brightness">+ <net.xmeter.samplers.PubSampler guiclass="net.xmeter.gui.PubSamplerUI" testclass="net.xmeter.samplers.PubSampler" testname="Publish brightness" enabled="true"><stringProp name="mqtt.topic_name">master/device${__threadNum}/writeattributevalue/brightness/${__groovy(vars.get("currentAssetId"))}</stringProp><stringProp name="mqtt.qos_level">0</stringProp><boolProp name="mqtt.add_timestamp">false</boolProp>@@ -184,7 +204,7 @@ return delay</stringProp><stringProp name="mqtt.connect_name">mqttconn</stringProp></net.xmeter.samplers.PubSampler><hashTree>- <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="Constant Timer">+ <ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="Constant Timer" enabled="true"><stringProp name="ConstantTimer.delay">50</stringProp></ConstantTimer><hashTree/>@@ -208,6 +228,12 @@ log.info(">>>Direct vars.get currentAssetId = " + vars.get(&q<hashTree/></hashTree></hashTree>+ <TestAction guiclass="TestActionGui" testclass="TestAction" testname="Flow Control Action">+ <intProp name="ActionProcessor.action">1</intProp>+ <intProp name="ActionProcessor.target">0</intProp>+ <stringProp name="ActionProcessor.duration">${__groovy((props.get("DISCONNECT_DELAY") ?: "0").toInteger() * 1000)}</stringProp>+ </TestAction>+ <hashTree/><net.xmeter.samplers.DisConnectSampler guiclass="net.xmeter.gui.DisConnectSamplerUI" testclass="net.xmeter.samplers.DisConnectSampler" testname="disconnect" enabled="true"><stringProp name="mqtt.connect_name">mqttconn</stringProp></net.xmeter.samplers.DisConnectSampler>diff --git a/test/load2-eks/scenarios/connect-and-publish.yml b/test/load2-eks/scenarios/connect-and-publish.ymlindex c51f63c46..004b23617 100644--- a/test/load2-eks/scenarios/connect-and-publish.yml+++ b/test/load2-eks/scenarios/connect-and-publish.yml@@ -7,7 +7,8 @@ settings:ASSETS_COUNT: 5RAMP_RATE: 20DURATION: 300- MILLIS_BETWEEN_PUBLISHES: 3000+ MILLIS_BETWEEN_PUBLISHES: 1000+ DISCONNECT_DELAY: 0reporting:- module: final-stats@@ -31,6 +32,7 @@ modules:RAMP_RATE: ${RAMP_RATE}DURATION: ${DURATION}MILLIS_BETWEEN_PUBLISHES: ${MILLIS_BETWEEN_PUBLISHES}+ DISCONNECT_DELAY: ${DISCONNECT_DELAY}execution:- scenario: simplediff --git a/test/load2-eks/scenarios/connect-settle-test.jmx b/test/load2-eks/scenarios/connect-settle-test.jmxindex ec678e0e9..1e790c5eb 100644--- a/test/load2-eks/scenarios/connect-settle-test.jmx+++ b/test/load2-eks/scenarios/connect-settle-test.jmx@@ -173,7 +173,7 @@ if (current >= vars.getObject("threadCount")) {</net.xmeter.samplers.PubSampler><hashTree><ConstantTimer guiclass="ConstantTimerGui" testclass="ConstantTimer" testname="Constant Timer">- <stringProp name="ConstantTimer.delay">${__P(MILLIS_BETWEEN_PUBLISHES,10000)}</stringProp>+ <stringProp name="ConstantTimer.delay">${__P(MILLIS_BETWEEN_PUBLISHES,30000)}</stringProp></ConstantTimer><hashTree/></hashTree>diff --git a/test/load2-eks/scenarios/connect-settle-test.yml b/test/load2-eks/scenarios/connect-settle-test.ymlindex 7f69098da..b783087b4 100644--- a/test/load2-eks/scenarios/connect-settle-test.yml+++ b/test/load2-eks/scenarios/connect-settle-test.yml@@ -3,9 +3,9 @@ settings:JMETER_VERSION: # Set by environment variable in docker imageJMETER_PLUGIN_MANAGER_VERSION: # Set by environment variable in docker imageMANAGER_HOSTNAME: # Must be supplied- THREAD_COUNT: 10000+ THREAD_COUNT: 1000RAMP_RATE: 50- MILLIS_BETWEEN_PUBLISHES: 300000+ MILLIS_BETWEEN_PUBLISHES: 30000reporting:- module: final-stats