Skip to content
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

DMP-4324: Dev Only: Resolve Flaky Embedded Wiremock Integration Tests #2405

Merged
merged 19 commits into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package uk.gov.hmcts.darts.testutils;

import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.BeforeEach;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
Expand All @@ -8,6 +9,7 @@

// port = 0 enables random ports as recommended by Wiremock. Tests will be faster and more reliable
@AutoConfigureWireMock(port = 0, files = "file:src/integrationTest/resources/wiremock")
@Slf4j
public class IntegrationBaseWithWiremock extends IntegrationBase {

@Value("${wiremock.server.port}")
Expand All @@ -17,10 +19,17 @@ public class IntegrationBaseWithWiremock extends IntegrationBase {
protected DartsGatewayStub dartsGateway;

@BeforeEach
@SuppressWarnings("PMD.DoNotUseThreads")
void setup() {
dartsGateway.clearStubs();

// populate the jkws keys endpoint with a global public key
tokenStub.stubExternalJwksKeys(DartsTokenGenerator.getGlobalKey());
try {
log.info("Wiremock Port: " + wiremockPort);
dartsGateway.clearStubs();
//Wait required to ensure that the wiremock server is up and running before the tests start
Thread.sleep(2000);
// populate the jkws keys endpoint with a global public key
tokenStub.stubExternalJwksKeys(DartsTokenGenerator.getGlobalKey());
} catch (Exception e) {
log.error("Error setting up wiremock", e);
}
}
}
8 changes: 1 addition & 7 deletions src/integrationTest/resources/application-intTest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,4 @@ logging:
gov:
hmcts:
darts: DEBUG
config: classpath:logback-test.xml

darts:
storage:

wiremock:
reset-mappings-after-each-test: true
config: classpath:logback-test.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"status": 200,
"demoMode": false,
"isError": false,
"responseStatus": 0
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"status": 200,
"demoMode": false,
"isError": false,
"responseStatus": 0,
"isValid": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"status": 200,
"demoMode": false,
"isError": false,
"responseStatus": 0,
"searchId": "8271f101-8c14-4c41-8865-edc5d8baed99"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a1,b2,c3
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"itemsCount": 1,
"status": 200,
"demoMode": false,
"isError": false,
"responseStatus": 0,
"productions": [
{
"productionID": "1b6a29d9-a72e-420b-8d69-b8acbeed806a"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"itemsCount": 1,
"status": 200,
"demoMode": false,
"isError": false,
"responseStatus": 0,
"searches": [
{
"search": {
"name": "DARTS_RPO_2024-08-13",
"totalCount": 5
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"itemsCount": 1,
"status": 200,
"demoMode": false,
"isError": false,
"responseStatus": 0,
"indexes": [
{
"index": {
"indexID": "c19454c6-c378-43c1-ae59-d0d013e30915"
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
{
"itemsCount": 25,
"status": 200,
"demoMode": false,
"isError": false,
"responseStatus": 0,
"masterIndexFields": [
{
"propertyName": "record_class",
"propertyType": "string",
"displayName": "Record Class",
"isMasked": false,
"masterIndexFieldID": "200b9c27-b497-4977-82e7-1586b32a5871"
},
{
"propertyName": "ingestionDate",
"propertyType": "date",
"displayName": "Archived Date",
"isMasked": false,
"masterIndexFieldID": "90ee0e13-8639-4c4a-b542-66b6c8911549"
},
{
"propertyName": "client_identifier",
"propertyType": "string",
"displayName": "Client Identifier",
"isMasked": false,
"masterIndexFieldID": "a9b8daf2-d9ff-4815-b65a-f6ae2763b92c"
},
{
"propertyName": "contributor",
"propertyType": "string",
"displayName": "Contributor",
"isMasked": false,
"masterIndexFieldID": "109b6bf1-57a0-48ec-b22e-c7248dc74f91"
},
{
"propertyName": "recordDate",
"propertyType": "date",
"displayName": "Record Date",
"isMasked": false,
"masterIndexFieldID": "893048bf-1e7c-4811-9abf-00cd77a715cf"
},
{
"propertyName": "bf_012",
"propertyType": "number",
"displayName": "ObjectId",
"isMasked": false,
"masterIndexFieldID": "fdd0fcbb-da46-4af1-a627-ac255c12bb23"
},
{
"propertyName": "bf_013",
"propertyType": "number",
"displayName": "ParentId",
"isMasked": false,
"masterIndexFieldID": "1332b6b2-d4b1-4a9a-b13d-f5a08d9cc803"
},
{
"propertyName": "bf_014",
"propertyType": "number",
"displayName": "Channel",
"isMasked": false,
"masterIndexFieldID": "0eb3adc8-f220-4074-9ad4-64c43313b5c6"
},
{
"propertyName": "bf_015",
"propertyType": "number",
"displayName": "MaxChannels",
"isMasked": false,
"masterIndexFieldID": "9af92904-442c-44c1-916c-c1ee6d019140"
},
{
"propertyName": "bf_001",
"propertyType": "string",
"displayName": "ObjectType",
"isMasked": false,
"masterIndexFieldID": "03d413d8-126e-4330-ba76-ff09405c2856"
},
{
"propertyName": "bf_002",
"propertyType": "string",
"displayName": "CaseNumbers",
"isMasked": false,
"masterIndexFieldID": "2fdfffce-0390-44b0-9b3f-038b790f26ad"
},
{
"propertyName": "bf_003",
"propertyType": "string",
"displayName": "FileType",
"isMasked": false,
"masterIndexFieldID": "6afc68a3-ea09-478c-ad28-a57b846c4d57"
},
{
"propertyName": "bf_005",
"propertyType": "string",
"displayName": "Checksum",
"isMasked": false,
"masterIndexFieldID": "5aa6b522-bcee-44d3-95d2-5497a636f387"
},
{
"propertyName": "bf_006",
"propertyType": "string",
"displayName": "TranscriptRequest",
"isMasked": false,
"masterIndexFieldID": "b885df16-7ce4-404c-a0c6-036d071d6a2f"
},
{
"propertyName": "bf_007",
"propertyType": "string",
"displayName": "TranscriptType",
"isMasked": false,
"masterIndexFieldID": "7cbc7937-87e6-4f8e-bc7b-de552ca8ed1e"
},
{
"propertyName": "bf_008",
"propertyType": "string",
"displayName": "TranscriptUrgency",
"isMasked": false,
"masterIndexFieldID": "ad3b574b-f0c7-492e-8a47-c9645b558c09"
},
{
"propertyName": "bf_009",
"propertyType": "string",
"displayName": "Comments",
"isMasked": false,
"masterIndexFieldID": "1337a236-c482-4a7d-baa3-4875cb484767"
},
{
"propertyName": "bf_016",
"propertyType": "string",
"displayName": "UploadedBy",
"isMasked": false,
"masterIndexFieldID": "ea88ea00-fb7c-41a3-b0c8-adf2bfb8df18"
},
{
"propertyName": "bf_004",
"propertyType": "date",
"displayName": "HearingDate",
"isMasked": false,
"masterIndexFieldID": "5865d506-87d9-4733-8efc-026d636793d4"
},
{
"propertyName": "bf_010",
"propertyType": "date",
"displayName": "CreatedDateTime",
"isMasked": false,
"masterIndexFieldID": "519d88cb-dad2-4c6a-ac3a-b41bc3519c68"
},
{
"propertyName": "bf_011",
"propertyType": "date",
"displayName": "StartDateTime",
"isMasked": false,
"masterIndexFieldID": "0c5b03b8-86f0-45df-a6ab-17085131b54c"
},
{
"propertyName": "bf_017",
"propertyType": "date",
"displayName": "EndDateTime",
"isMasked": false,
"masterIndexFieldID": "9fb67f04-5fac-4d41-97ef-ac92267ff0e7"
},
{
"propertyName": "bf_018",
"propertyType": "date",
"displayName": "PlaceholderDate",
"isMasked": false,
"masterIndexFieldID": "94aadf8a-a13e-4b35-af25-034f01f1f2c2"
},
{
"propertyName": "bf_019",
"propertyType": "string",
"displayName": "Courthouse",
"isMasked": false,
"masterIndexFieldID": "11dc6223-fd52-4714-950b-d74d721f1dae"
},
{
"propertyName": "bf_020",
"propertyType": "string",
"displayName": "Courtroom",
"isMasked": false,
"masterIndexFieldID": "ae888318-1500-44f4-92b9-f09824e6ae1f"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"itemsCount": 1,
"status": 200,
"demoMode": false,
"isError": false,
"responseStatus": 0,
"productionExportFile": [
{
"productionExportFile": {
"productionExportFileID": "741d78c1-d722-419d-b72c-74f9972ff60e"
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"itemsCount": 1,
"status": 200,
"demoMode": false,
"isError": false,
"responseStatus": 0,
"entitlements": [
{
"name": "SRV-DARTS-RW-E",
"entitlementID": "96293900-5082-4051-bbad-c961fb22091d"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"status": 200,
"demoMode": false,
"isError": false,
"responseStatus": 0,
"recordManagementMatter": {
"matterCategory": 3,
"name": "Records Management",
"description": "Records Management",
"createdDate": "2022-12-14T08:50:55.75Z",
"type": 1,
"status": 0,
"quickSearch": false,
"closed": false,
"matterID": "cb70c7fa-8972-4400-af1d-ff5dd76d2104",
"isUsedForRM": true
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"status": 200,
"demoMode": false,
"isError": false,
"responseStatus": 0,
"data": [
{
"id": "aeb01bc8-9292-47a7-88a3-8fc89ebc3e10",
"name": "a360c2x2555blob"
},
{
"id": "df29511c-76c4-46d4-80c1-9d7f108eb551",
"name": "a360c2x2555json"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"status": 200,
"demoMode": false,
"isError": false,
"responseStatus": 0
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"isValid": false,
"status": 200,
"demoMode": false,
"isError": false,
"responseStatus": 0,
"responseStatusMessages": null,
"exception": null,
"message": null
}
Loading
Loading