-
Notifications
You must be signed in to change notification settings - Fork 1
DFI-1577 rework performance test setup #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
383b8dd
924e55a
c5a4f65
7b6df34
4327252
16ac59a
c6cda05
7634e2d
10c842b
99c7fe6
7d5361e
7aad740
da1011c
f4e0bc9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| import scala.collection.Seq | ||
|
|
||
| lazy val root = (project in file(".")) | ||
| .enablePlugins(GatlingPlugin) | ||
| .settings( | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,15 +19,30 @@ package uk.gov.hmrc.perftests.disareturns | |
| import io.gatling.core.Predef._ | ||
| import io.gatling.http.Predef._ | ||
| import io.gatling.http.request.builder.HttpRequestBuilder | ||
| import uk.gov.hmrc.perftests.disareturns.Util.MockMonthlyReturnData.validNdjsonTestData | ||
| import uk.gov.hmrc.perftests.disareturns.Util.NdjsonPayloadGenerator | ||
| import uk.gov.hmrc.perftests.disareturns.constant.AppConfig.{disaReturnsHost, disaReturnsRoute} | ||
| import uk.gov.hmrc.perftests.disareturns.constant.Headers.headerWithClientIdAndBearerToken | ||
|
|
||
| import java.nio.file.{Files, Paths, StandardOpenOption} | ||
|
|
||
| object MonthlyReturnsSubmissionRequests { | ||
|
|
||
| private val submissionPayloadFilePath: String = { | ||
| val path = "target/monthly-return-payload.ndjson" | ||
| val ndjson = NdjsonPayloadGenerator.generateNdjsonPayload() | ||
| val filePath = Paths.get(path) | ||
| Files.write(filePath, ndjson.getBytes("UTF-8"), | ||
| StandardOpenOption.CREATE, | ||
| StandardOpenOption.TRUNCATE_EXISTING | ||
| ) | ||
| path | ||
| } | ||
|
|
||
| val submitMonthlyReport: HttpRequestBuilder = | ||
| http("Submit monthly report") | ||
| .post(s"$disaReturnsHost$disaReturnsRoute#{isaManagerReference}/#{taxYear}/#{month}") | ||
| .headers(headerWithClientIdAndBearerToken) | ||
| .body(StringBody(validNdjsonTestData())) | ||
| .body(RawFileBody(submissionPayloadFilePath)).asJson | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What RawFileBody does: Open NDJSON file → stream bytes → write to buffer → send appose to what we was happening previously with StringBody Load entire file → build giant String → send This was consuming large amounts of gatlings memory resulting in OOM expections
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we configure this? Robs comment |
||
| .check(status.is(204)) | ||
|
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| /* | ||
| * Copyright 2023 HM Revenue & Customs | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package uk.gov.hmrc.perftests.disareturns | ||
|
|
||
| import io.gatling.core.Predef._ | ||
| import io.gatling.http.Predef._ | ||
| import io.gatling.http.request.builder.HttpRequestBuilder | ||
| import uk.gov.hmrc.perftests.disareturns.constant.AppConfig.{disaReturnsStubHost, openObligationStatusPath} | ||
| import uk.gov.hmrc.perftests.disareturns.constant.Headers.headerWithClientIdAndBearerToken | ||
|
|
||
| object TestOnlyRequests { | ||
| val openObligationStatus: HttpRequestBuilder = | ||
| http("Open Obligation Status") | ||
| .post(s"$disaReturnsStubHost$openObligationStatusPath#{isaManagerReference}") | ||
| .headers(headerWithClientIdAndBearerToken) | ||
| .body(StringBody("")) | ||
| .check(status.is(200)) | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| /* | ||
| * Copyright 2026 HM Revenue & Customs | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package uk.gov.hmrc.perftests.disareturns.Util | ||
|
|
||
| import java.lang.management.{BufferPoolMXBean, ManagementFactory} | ||
| import scala.jdk.CollectionConverters._ | ||
|
|
||
| object DirectMemoryLogger { | ||
|
|
||
| def log(): Unit = { | ||
| val bufferPools: Seq[BufferPoolMXBean] = | ||
| ManagementFactory.getPlatformMXBeans(classOf[BufferPoolMXBean]).asScala.toSeq | ||
|
|
||
| bufferPools.foreach { pool => | ||
| if (pool.getName == "direct") { | ||
| val usedMb = pool.getMemoryUsed / 1024 / 1024 | ||
| val capMb = pool.getTotalCapacity / 1024 / 1024 | ||
| val count = pool.getCount | ||
|
|
||
| println( | ||
| s"[DIRECT MEMORY] Used: ${usedMb}MB | Capacity: ${capMb}MB | Buffers: $count" | ||
| ) | ||
| } | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are we running 'nps-retrieve-monthly-summary-and-report' later ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep put todos in simulation and created https://jira.tools.tax.service.gov.uk/browse/DFI-1720 here to fully implement the get report reconciliation & test support integration