Skip to content

Commit

Permalink
fix scenarios for 7.10 release
Browse files Browse the repository at this point in the history
  • Loading branch information
dmlemeshko committed Nov 12, 2020
1 parent 3ebf7e6 commit 4ab16b9
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 16 deletions.
10 changes: 10 additions & 0 deletions src/test/resources/config/deploy/7.10.0.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version = 7.10.0

elasticsearch {
deployment_template = "gcp-io-optimized"
memory = 8192
}

kibana {
memory = 1024
}
35 changes: 22 additions & 13 deletions src/test/scala/org/kibanaLoadTest/scenario/Canvas.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -60,12 +68,13 @@ 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)
.header("Referer", baseUrl + "/app/canvas")
.check(status.is(200))
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Expand Down Expand Up @@ -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)
Expand All @@ -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",
Expand Down

0 comments on commit 4ab16b9

Please sign in to comment.