Skip to content
This repository has been archived by the owner on Apr 26, 2021. It is now read-only.

ElasticSearch_PerformanceTests #11

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Binary file modified .DS_Store
Binary file not shown.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
*.iml
.idea/*
target/*

results/
src.zip
.DS_Store
/gatling.log
68 changes: 59 additions & 9 deletions src/test/resources/application.conf
Original file line number Diff line number Diff line change
Expand Up @@ -75,26 +75,66 @@ cnp_sanbox {
httpProxyPort = "8080"
userCcdId = 6687
userImportId = 445
idamS2SUrl = "http://betaDevBccidamS2SLB.reform.hmcts.net"
idamS2SUrl = "http://rpe-service-auth-provider-sandbox.service.core-compute-sandbox.internal"
idamUserTokenUrl = "http://betaDevBccidamAppLB.reform.hmcts.net"
userProfileUrl = "https://ccd-user-profile-api-sandbox.service.core-compute-sandbox.internal"
caseDataUrl = "https://ccd-data-store-api-sandbox.service.core-compute-sandbox.internal"
caseDefinitionUrl = "https://ccd-definition-store-api-sandbox.service.core-compute-sandbox.internal"
dataStoreS2STokenGeneratorSecret = "${IDAM_KEY_CCD_DATA_STORE}"
gatewayS2STokenGeneratorSecret = "${IDAM_KEY_CCD_GATEWAY}"
getCaseUrl = "caseworkers/6687/jurisdictions/DIVORCE/case-types/DIVORCE/cases/1512470862480575"
getCaseUrl = "caseworkers/6687/jurisdictions/DIVORCE/case-types/DIVORCE/cases/1537538269434386"
createCaseUrl = "caseworkers/6687/jurisdictions/PROBATE/case-types/GrantOfRepresentation/cases"
}

cnp_sprod {
cnp_sandbox {
maxSimulationDurationMinutes = 99999
maxResponseTime = 20000
meanResponseTime = 1000
minthinktime = 2
maxthinktime = 3
minWaitForNextIteration = 4
maxWaitForNextIteration = 5
totalDuration = 2
totalDuration = 1
reachRPSTarget = 20
reachRPSDuration = 10
reachRPSHoldForDuration = 60
jumptoRPSTarget = 50
jumptoRPSDuration = 900
httpProxyHost = "proxyout.reform.hmcts.net"
httpProxyPort = "8080"
userCcdId = 176475
userImportId = 445
idamS2SUrl = "http://rpe-service-auth-provider-sandbox.service.core-compute-sandbox.internal"
idamUserTokenUrl = "http://betaDevBccidamAppLB.reform.hmcts.net"
userProfileUrl = "https://ccd-user-profile-api-sandbox.service.core-compute-sandbox.internal"
caseDataUrl = "https://ccd-data-store-api-sandbox.service.core-compute-sandbox.internal"
caseDefinitionUrl = "https://ccd-definition-store-api-sandbox.service.core-compute-sandbox.internal"
dataStoreS2STokenGeneratorSecret = "${IDAM_KEY_CCD_DATA_STORE}"
gatewayS2STokenGeneratorSecret = "${IDAM_KEY_CCD_GATEWAY}"
getCaseUrl = "aggregated/caseworkers/176475/jurisdictions/AUTOTEST1/case-types/AAT/cases/1537782078866335"
createCaseUrl = "caseworkers/176475/jurisdictions/:jurisdictions_reference/case-types/:casetype_reference/cases"
validateCaseUrl = "caseworkers/176475/jurisdictions/AUTOTEST1/case-types/AAT/cases"
getUserProfileUrl = "caseworkers/176475/profile"
searchCases = "aggregated/caseworkers/176475/jurisdictions/AUTOTEST1/case-types/AAT/cases?state=CaseCreated"
getPaginationMetadataUrl = "caseworkers/176475/jurisdictions/AUTOTEST1/case-types/AAT/cases/pagination_metadata?state=CaseCreated"
saveEventUrl = "caseworkers/176475/jurisdictions/AUTOTEST1/case-types/CASETYPE2/cases/1531207599597587/events"
searchInputDetails = "aggregated/caseworkers/176475/jurisdictions/AUTOTEST1/case-types/AAT/inputs"
workbasketInputDetails = "/aggregated/caseworkers/176475/jurisdictions/AUTOTEST1/case-types/AAT/work-basket-inputs"
getPrintableDocumentsForEvent = "caseworkers/176475/jurisdictions/AUTOTEST1/case-types/CASETYPE2/cases/1531207599597587/documents"
validateCaseDetails = "caseworkers/176475/jurisdictions/AUTOTEST1/case-types/AAT/validate"
docStoreBashURL = "https://dm-store-sprod.service.core-compute-sprod.internal"
ESSearch = "searchCases"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be called searchUrl instead of ESSearch

}

cnp_sprod {
maxSimulationDurationMinutes = 99999
maxResponseTime = 20000
meanResponseTime = 1000
minthinktime = 1
maxthinktime = 2
minWaitForNextIteration = 1
maxWaitForNextIteration = 2
totalDuration = 1
reachRPSTarget = 20
reachRPSDuration = 10
reachRPSHoldForDuration = 60
Expand All @@ -107,18 +147,27 @@ cnp_sprod {
idamS2SUrl = "http://rpe-service-auth-provider-sprod.service.core-compute-sprod.internal"
idamUserTokenUrl = "http://betaDevBccidamAppLB.reform.hmcts.net"
userProfileUrl = "https://ccd-user-profile-api-sprod.service.core-compute-sprod.internal"
escaseDataUrl = "https://ccd-api-gateway-web-sprod.service.core-compute-sprod.internal"
caseDataUrl = "https://ccd-data-store-api-sprod.service.core-compute-sprod.internal"
caseDefinitionUrl = "https://ccd-definition-store-api-sprod.service.core-compute-sprod.internal"
dataStoreS2STokenGeneratorSecret = "${IDAM_KEY_CCD_DATA_STORE}"
gatewayS2STokenGeneratorSecret = "${IDAM_KEY_CCD_GATEWAY}"
getCaseUrl = "caseworkers/176475/jurisdictions/AUTOTEST1/case-types/AAT/cases/1525778314235511"
createCaseUrl = "caseworkers/176475/jurisdictions/AUTOTEST1/case-types/AAT/cases"
getCaseUrl = "aggregated/caseworkers/176475/jurisdictions/AUTOTEST1/case-types/AAT/cases/1532983170361929"
createCaseUrl = "caseworkers/176475/jurisdictions/:jurisdictions_reference/case-types/:casetype_reference/cases"
validateCaseUrl = "caseworkers/176475/jurisdictions/AUTOTEST1/case-types/AAT/cases"
getUserProfileUrl = "caseworkers/176475/profile"
searchCases = "caseworkers/176475/jurisdictions/AUTOTEST1/case-types/AAT/cases?state=CaseCreated"
searchCases = "aggregated/caseworkers/176475/jurisdictions/AUTOTEST1/case-types/AAT/cases?state=CaseCreated"
getPaginationMetadataUrl = "caseworkers/176475/jurisdictions/AUTOTEST1/case-types/AAT/cases/pagination_metadata?state=CaseCreated"
saveEventUrl = "caseworkers/176475/jurisdictions/AUTOTEST1/case-types/AAT/cases/1525778314235511/events"
saveEventUrl = "caseworkers/176475/jurisdictions/AUTOTEST1/case-types/CASETYPE2/cases/1531207599597587/events"
searchInputDetails = "aggregated/caseworkers/176475/jurisdictions/AUTOTEST1/case-types/AAT/inputs"
workbasketInputDetails = "/aggregated/caseworkers/176475/jurisdictions/AUTOTEST1/case-types/AAT/work-basket-inputs"
getPrintableDocumentsForEvent = "caseworkers/176475/jurisdictions/AUTOTEST1/case-types/CASETYPE2/cases/1531207599597587/documents"
validateCaseDetails = "caseworkers/176475/jurisdictions/AUTOTEST1/case-types/AAT/validate"
docStoreBashURL = "https://dm-store-sprod.service.core-compute-sprod.internal"
ESSearch = "searchCases"
}


cnp_aat {
maxSimulationDurationMinutes = 99999
maxResponseTime = 20000
Expand All @@ -127,7 +176,7 @@ cnp_aat {
maxthinktime = 2
minWaitForNextIteration = 1
maxWaitForNextIteration = 2
totalDuration = 1000
totalDuration = 2
reachRPSTarget = 50
reachRPSDuration = 10
reachRPSHoldForDuration = 60
Expand All @@ -152,6 +201,7 @@ cnp_aat {
cases = ["1521477620166395", "1521-4779-1892-1964", "1521477967979301", "1521477963778319", "1521-4779-6301-4715", "1521-4779-5350-7637", "1521-4779-4876-0499", "1521-4779-4365-6189"]
getCaseUrl = "caseworkers/18/jurisdictions/SSCS/case-types/Benefit/cases/:case_reference"
saveEventUrl = "caseworkers/6687/jurisdictions/PROBATE/case-types/GrantOfRepresentation/cases/1520505513296274/events"
createCaseUrl = "caseworkers/176475/jurisdictions/AUTOTEST1/case-types/AAT/cases?ignore-warning=false"
createCaseUrl = "caseworkers/6687/jurisdictions/PROBATE/case-types/GrantOfRepresentation/cases"
getPaginationMetadataUrl = "caseworkers/6687/jurisdictions/PROBATE/case-types/GrantOfRepresentation/cases/pagination_metadata?state=CaseCreated"
searchCases = "caseworkers/6687/jurisdictions/PROBATE/case-types/GrantOfRepresentation/cases?state=CaseCreated"
Expand Down
39 changes: 16 additions & 23 deletions src/test/resources/logback-test.xml
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>

<contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator">
<resetJUL>true</resetJUL>
</contextListener>

<!-- <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%-5level] %logger{15} - %msg%n%rEx</pattern>
<immediateFlush>false</immediateFlush>
</encoder>
</appender> -->
<!-- <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%-5level] %logger{15} - %msg%n%rEx</pattern>
</encoder>
<immediateFlush>false</immediateFlush>
</appender> -->

<appender name="FILE" class="ch.qos.logback.core.FileAppender">
<file>gatling.log</file>
Expand All @@ -21,22 +17,19 @@
</appender>

<!-- Uncomment for logging ALL HTTP request and responses -->
<!-- <logger name="io.gatling.http" level="TRACE" /> -->
<!-- <logger name="io.gatling.http.ahc" level="TRACE" /> -->
<!-- <logger name="io.gatling.http.response" level="TRACE" /> -->
<logger name="io.gatling.http.ahc" level="TRACE" />
<logger name="io.gatling.http.response" level="TRACE" />
<!-- Uncomment for logging ONLY FAILED HTTP request and responses -->
<logger name="io.gatling.http" level="TRACE" />
<logger name="io.gatling.http.ahc" level="DEBUG" />
<logger name="io.gatling.http.response" level="DEBUG" />

<root level="WARN">
<appender-ref ref="FILE" />
</root>
<!--<logger name="io.gatling.http.ahc" level="DEBUG" />-->
<!--<logger name="io.gatling.http.response" level="DEBUG" />-->

<!-- <root level="WARN">
<appender-ref ref="CONSOLE" />
</root> -->

<root level="WARN">
<appender-ref ref="FILE" />
</root>

<!-- <root level="WARN">
<appender-ref ref="CONSOLE" />
</root> -->

</configuration>
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package uk.gov.hmcts.ccd.corecasedata.scenarios

import io.gatling.core.Predef._
import io.gatling.http.Predef._
import uk.gov.hmcts.ccd.util.{CcdTokenGenerator, PerformanceTestsConfig}

import scala.concurrent.duration._

object ESExactMatchYesOrNo extends PerformanceTestsConfig {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you rename from ESExactMatchYesOrNo to SearchExactMatchYesOrNo


private val url: String = config.getString("caseDataUrl") + "/" + config.getString("ESSearch")
println("Elastic Search Exact Match on YesORNo field PT - URL: " + url)

val ESExactMatchYesOrNoReqPayload = StringBody(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we just name this payload

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similar in other places

"""
{
"query":{
"bool":{
"filter":{
"match":{
"data.YesOrNoField":"Yes"
}
}
}
}
}
"""
)

def httpRequest() = {
val s2sToken = CcdTokenGenerator.generateGatewayS2SToken()
val userToken = CcdTokenGenerator.generateWebUserToken(url)

http("TX12_CCD_ElasticSearchEndpoint_ExactMatch_YesORNoField")
.post(url)
.queryParam("ctid", "AAT")
.body(
ESExactMatchYesOrNoReqPayload).asJSON
.header("ServiceAuthorization", s2sToken)
.header("Authorization", userToken)
.header("Content-Type","application/json")
.check(status in (200))
}

println("ESExactMatchYesOrNo: Minimum think time " + MinThinkTime + " Maximum think time " + MaxThinkTime)

val ESExactMatchYesOrNoSCN = scenario("Elastic Search Exact Match on YesORNo Field").during(TotalRunDuration minutes) {
exec(
httpRequest()
)
.pause(MinThinkTime seconds, MaxThinkTime seconds)
}

val waitForNextIteration = pace(MinWaitForNextIteration seconds, MaxWaitForNextIteration seconds)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package uk.gov.hmcts.ccd.corecasedata.scenarios

import io.gatling.core.Predef._
import io.gatling.http.Predef._
import uk.gov.hmcts.ccd.util.{CcdTokenGenerator, PerformanceTestsConfig}

import scala.concurrent.duration._

object ESMatchAllCases extends PerformanceTestsConfig {

private val url: String = config.getString("caseDataUrl") + "/" + config.getString("ESSearch")
println("Elastic Search Match All & return 50 PT - URL: " + url)

val ReqPayload = StringBody(
"""
{
"query": {
"match_all": {}
},
"size": 50
}
"""
)

def httpRequest() = {
val s2sToken = CcdTokenGenerator.generateGatewayS2SToken()
val userToken = CcdTokenGenerator.generateWebUserToken(url)

http("TX11_CCD_ElasticSearchEndpoint_MatchAll_Return50Cases")
.post(url)
.queryParam("ctid", "AAT")
.body(
ReqPayload).asJSON
.header("ServiceAuthorization", s2sToken)
.header("Authorization", userToken)
.header("Content-Type","application/json")
.check(status in (200))
}

println("ESMatchAllCases: Minimum think time " + MinThinkTime + " Maximum think time " + MaxThinkTime)

val ESMatchAll_Return50Cases = scenario("Elastic Search Match all and return 50 cases").during(TotalRunDuration minutes) {
exec(
httpRequest()
)
.pause(MinThinkTime seconds, MaxThinkTime seconds)
}

val waitForNextIteration = pace(MinWaitForNextIteration seconds, MaxWaitForNextIteration seconds)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package uk.gov.hmcts.ccd.corecasedata.scenarios

import io.gatling.core.Predef._
import io.gatling.http.Predef._
import uk.gov.hmcts.ccd.util.{CcdTokenGenerator, PerformanceTestsConfig}

import scala.concurrent.duration._

object ESSeachONTextArea extends PerformanceTestsConfig {

private val url: String = config.getString("caseDataUrl") + "/" + config.getString("ESSearch")
println("Elastic Search on text area field PT - URL: " + url)

val ESSeachONTextAreaReqPayload = StringBody(
"""
{
"query":{
"match_phrase_prefix":{
"data.TextAreaField":"Performance Testing "
}
},
"sort":[
{
"last_modified":"desc"
},
"_score"
]
}
"""
)

def httpRequest() = {
val s2sToken = CcdTokenGenerator.generateGatewayS2SToken()
val userToken = CcdTokenGenerator.generateWebUserToken(url)

http("TX14_CCD_ElasticSearchEndpoint_SearchONTextAreaField")
.post(url)
.queryParam("ctid", "AAT")
.body(
ESSeachONTextAreaReqPayload).asJSON
.header("ServiceAuthorization", s2sToken)
.header("Authorization", userToken)
.header("Content-Type","application/json")
.check(status in (200))
}

println("ESSeachONTextArea: Minimum think time " + MinThinkTime + " Maximum think time " + MaxThinkTime)

val ESSeachONTextAreaSCN = scenario("Elastic Search on TextArea Field").during(TotalRunDuration minutes) {
exec(
httpRequest()
)
.pause(MinThinkTime seconds, MaxThinkTime seconds)
}

val waitForNextIteration = pace(MinWaitForNextIteration seconds, MaxWaitForNextIteration seconds)
}
Loading