Commit d4b88f802a0bd0d9adfcfd4b5cfb7df6049c614c

Authored by volodymyr-babak
1 parent 13a8232d

added connect-publish scenario

@@ -32,7 +32,7 @@ do @@ -32,7 +32,7 @@ do
32 done 32 done
33 33
34 # Copying env variables into conf files 34 # Copying env variables into conf files
35 -printenv | while read x; do echo export $x; done >> /usr/share/thingsboard/conf/thingsboard.conf 35 +printenv | awk -F "=" '{print "export " $1 "='\''" $2 "'\''"}' >> /usr/share/thingsboard/conf/thingsboard.conf
36 36
37 cat /usr/share/thingsboard/conf/thingsboard.conf 37 cat /usr/share/thingsboard/conf/thingsboard.conf
38 38
@@ -27,7 +27,7 @@ public class TestParams { @@ -27,7 +27,7 @@ public class TestParams {
27 static final String TEST_PROPERTIES = "test.properties"; 27 static final String TEST_PROPERTIES = "test.properties";
28 static final long DEFAULT_TEST_DURATION = TimeUnit.MINUTES.toMillis(1); 28 static final long DEFAULT_TEST_DURATION = TimeUnit.MINUTES.toMillis(1);
29 static final long DEFAULT_TEST_INTERVAL = TimeUnit.MILLISECONDS.toMillis(100); 29 static final long DEFAULT_TEST_INTERVAL = TimeUnit.MILLISECONDS.toMillis(100);
30 - static final int DEFAULT_DEVICE_COUNT = 100; 30 + static final int DEFAULT_DEVICE_COUNT = 25;
31 static final String DEFAULT_REST_URL = "http://localhost:8080"; 31 static final String DEFAULT_REST_URL = "http://localhost:8080";
32 static final String DEFAULT_MQTT_URLS = "tcp://localhost:1883"; 32 static final String DEFAULT_MQTT_URLS = "tcp://localhost:1883";
33 static final String DEFAULT_USERNAME = "tenant@thingsboard.org"; 33 static final String DEFAULT_USERNAME = "tenant@thingsboard.org";
1 /** 1 /**
  2 + * Copyright © 2016 The Thingsboard Authors
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License");
  5 + * you may not use this file except in compliance with the License.
  6 + * You may obtain a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS,
  12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 + * See the License for the specific language governing permissions and
  14 + * limitations under the License.
  15 + */
  16 +/**
2 * Copyright © 2016 The Thingsboard Authors 17 * Copyright © 2016 The Thingsboard Authors
3 * 18 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); 19 * Licensed under the Apache License, Version 2.0 (the "License");
@@ -27,14 +42,21 @@ class MqttSimulation extends Simulation { @@ -27,14 +42,21 @@ class MqttSimulation extends Simulation {
27 .host("tcp://localhost:1883") 42 .host("tcp://localhost:1883")
28 .userName("${deviceCredentialsId}") 43 .userName("${deviceCredentialsId}")
29 44
30 - val scn = scenario("MQTT Test")  
31 - .feed(csv("/tmp/mqtt.csv").circular)  
32 - .exec(mqtt("request") 45 + val connect = exec(mqtt("connect")
  46 + .connect())
  47 +
  48 + val publish = repeat(400) {
  49 + exec(mqtt("publish")
33 .publish("v1/devices/me/telemetry", "{\"key1\":\"value1\", \"key2\":\"value2\"}", QoS.AT_LEAST_ONCE, retain = false)) 50 .publish("v1/devices/me/telemetry", "{\"key1\":\"value1\", \"key2\":\"value2\"}", QoS.AT_LEAST_ONCE, retain = false))
  51 + }
  52 +
  53 + val scn = scenario("Scenario Name")
  54 + .feed(csv("/tmp/mqtt.csv").circular)
  55 + .exec(connect, publish)
34 56
35 setUp( 57 setUp(
36 scn 58 scn
37 - .inject(constantUsersPerSec(1000) during (5 seconds)) 59 + .inject(constantUsersPerSec(25) during (1 seconds))
38 ).protocols(mqttConf) 60 ).protocols(mqttConf)
39 61
40 } 62 }