From 4ab16b985467e07d68de3fea87e657b70f039b37 Mon Sep 17 00:00:00 2001 From: Dzmitry Lemechko Date: Thu, 12 Nov 2020 12:07:48 +0100 Subject: [PATCH] fix scenarios for 7.10 release --- src/test/resources/config/deploy/7.10.0.conf | 10 ++++++ .../org/kibanaLoadTest/scenario/Canvas.scala | 35 ++++++++++++------- .../simulation/BaseSimulation.scala | 8 +++-- 3 files changed, 37 insertions(+), 16 deletions(-) create mode 100644 src/test/resources/config/deploy/7.10.0.conf diff --git a/src/test/resources/config/deploy/7.10.0.conf b/src/test/resources/config/deploy/7.10.0.conf new file mode 100644 index 00000000..e1d875f5 --- /dev/null +++ b/src/test/resources/config/deploy/7.10.0.conf @@ -0,0 +1,10 @@ +version = 7.10.0 + +elasticsearch { + deployment_template = "gcp-io-optimized" + memory = 8192 +} + +kibana { + memory = 1024 +} \ No newline at end of file diff --git a/src/test/scala/org/kibanaLoadTest/scenario/Canvas.scala b/src/test/scala/org/kibanaLoadTest/scenario/Canvas.scala index 98ddd15e..1fe4a692 100644 --- a/src/test/scala/org/kibanaLoadTest/scenario/Canvas.scala +++ b/src/test/scala/org/kibanaLoadTest/scenario/Canvas.scala @@ -3,11 +3,18 @@ package org.kibanaLoadTest.scenario import io.gatling.core.Predef._ import io.gatling.core.structure.ChainBuilder import io.gatling.http.Predef._ +import org.kibanaLoadTest.helpers.Version import scala.concurrent.duration.DurationInt object Canvas { - def loadWorkpad(baseUrl: String, headers: Map[String, String]): ChainBuilder = + def loadWorkpad( + baseUrl: String, + headers: Map[String, String] + ): ChainBuilder = { + val version = new Version(headers("kbn-version")) + val fnsPath = + if (version.isAbove79x) "/api/canvas/fns" else "/api/interpreter/fns" exec( http("canvas workpads") .get("/api/canvas/workpad/find") @@ -19,16 +26,17 @@ object Canvas { .check() .check(jsonPath("$.workpads[0].id").saveAs("workpadId")) ).exitBlockOnFail { - exec( - http("interpreter demo") - .get("/api/interpreter/fns") - .queryParam("name", "") - .queryParam("perPage", "10000") - .headers(headers) - .header("Referer", baseUrl + "/app/canvas") - .check(status.is(200)) - ).pause(5 seconds) - .exec( + doIf(version.isAbove79x) { + exec( + http("interpreter demo") + .get(fnsPath) + .queryParam("name", "") + .queryParam("perPage", "10000") + .headers(headers) + .header("Referer", baseUrl + "/app/canvas") + .check(status.is(200)) + ).pause(5 seconds) + }.exec( http("load workpad") .get("/api/canvas/workpad/${workpadId}") .headers(headers) @@ -50,7 +58,7 @@ object Canvas { .pause(1 seconds) .exec( http("query canvas aggs 1") - .post("/api/interpreter/fns") + .post(fnsPath) .body(ElFileBody("data/canvasInterpreterPayload1.json")) .asJson .headers(headers) @@ -60,7 +68,7 @@ object Canvas { .pause(1 seconds) .exec( http("query canvas aggs 2") - .post("/api/interpreter/fns") + .post(fnsPath) .body(ElFileBody("data/canvasInterpreterPayload2.json")) .asJson .headers(headers) @@ -68,4 +76,5 @@ object Canvas { .check(status.is(200)) ) } + } } diff --git a/src/test/scala/org/kibanaLoadTest/simulation/BaseSimulation.scala b/src/test/scala/org/kibanaLoadTest/simulation/BaseSimulation.scala index 0c58a874..7681d064 100644 --- a/src/test/scala/org/kibanaLoadTest/simulation/BaseSimulation.scala +++ b/src/test/scala/org/kibanaLoadTest/simulation/BaseSimulation.scala @@ -6,7 +6,7 @@ import java.nio.file.Paths import io.gatling.core.Predef._ import io.gatling.http.Predef._ import org.kibanaLoadTest.KibanaConfiguration -import org.kibanaLoadTest.helpers.{CloudHttpClient, Helper, HttpHelper} +import org.kibanaLoadTest.helpers.{CloudHttpClient, Helper, HttpHelper, Version} import org.slf4j.{Logger, LoggerFactory} import com.typesafe.config.{ConfigFactory, ConfigValueFactory} @@ -70,6 +70,8 @@ class BaseSimulation extends Simulation { def createDeployment(deployConfigName: String): KibanaConfiguration = { val config = Helper.readResourceConfigFile(deployConfigName) + val version = new Version(config.getString("version")) + val providerName = if (version.isAbove79x) "cloud-basic" else "basic-cloud" val cloudClient = new CloudHttpClient val payload = cloudClient.preparePayload(config) val metadata = cloudClient.createDeployment(payload) @@ -84,13 +86,13 @@ class BaseSimulation extends Simulation { .withValue("app.host", ConfigValueFactory.fromAnyRef(host)) .withValue( "app.version", - ConfigValueFactory.fromAnyRef(config.getString("version")) + ConfigValueFactory.fromAnyRef(version.get) ) .withValue("security.on", ConfigValueFactory.fromAnyRef(true)) .withValue("auth.providerType", ConfigValueFactory.fromAnyRef("basic")) .withValue( "auth.providerName", - ConfigValueFactory.fromAnyRef("basic-cloud") + ConfigValueFactory.fromAnyRef(providerName) ) .withValue( "auth.username",