From a02345ebfefa8530ae8304b6715b4b2abd4e51ac Mon Sep 17 00:00:00 2001 From: Samyak Gantayat Date: Mon, 3 Feb 2025 12:53:08 +0530 Subject: [PATCH 1/3] Excluded endpoints added in filter removed from specmatic config exclusions --- .../kotlin/com/component/orders/contract/ContractTests.kt | 4 ++-- src/test/resources/specmatic.yaml | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/test/kotlin/com/component/orders/contract/ContractTests.kt b/src/test/kotlin/com/component/orders/contract/ContractTests.kt index bdd3669..c45c735 100644 --- a/src/test/kotlin/com/component/orders/contract/ContractTests.kt +++ b/src/test/kotlin/com/component/orders/contract/ContractTests.kt @@ -25,14 +25,14 @@ class ContractTests : SpecmaticContractTest { private const val ACTUATOR_MAPPINGS_ENDPOINT = "http://$APPLICATION_HOST:$APPLICATION_PORT/actuator/mappings" private const val EXPECTED_NUMBER_OF_MESSAGES = 4 - + private const val EXCLUDED_ENDPOINTS = "/health" @JvmStatic @BeforeAll fun setUp() { System.setProperty("host", APPLICATION_HOST) System.setProperty("port", APPLICATION_PORT) System.setProperty("endpointsAPI", ACTUATOR_MAPPINGS_ENDPOINT) - + System.setProperty("filter","PATH!=$EXCLUDED_ENDPOINTS") // Start Specmatic Http Stub and set the expectations httpStub = createStub(listOf("./src/test/resources/domain_service"), HTTP_STUB_HOST, HTTP_STUB_PORT) diff --git a/src/test/resources/specmatic.yaml b/src/test/resources/specmatic.yaml index 0726e22..9a6e340 100644 --- a/src/test/resources/specmatic.yaml +++ b/src/test/resources/specmatic.yaml @@ -25,6 +25,4 @@ report: minThresholdPercentage: 70 maxMissedEndpointsInSpec: 0 enforce: true - excludedEndpoints: - - /health From 73edb7c29d2aa6d79133743a7351cff2e8e30f64 Mon Sep 17 00:00:00 2001 From: Samyak Gantayat Date: Mon, 3 Feb 2025 12:56:20 +0530 Subject: [PATCH 2/3] Missing single quotes added --- src/test/kotlin/com/component/orders/contract/ContractTests.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/kotlin/com/component/orders/contract/ContractTests.kt b/src/test/kotlin/com/component/orders/contract/ContractTests.kt index c45c735..98bbde6 100644 --- a/src/test/kotlin/com/component/orders/contract/ContractTests.kt +++ b/src/test/kotlin/com/component/orders/contract/ContractTests.kt @@ -25,7 +25,7 @@ class ContractTests : SpecmaticContractTest { private const val ACTUATOR_MAPPINGS_ENDPOINT = "http://$APPLICATION_HOST:$APPLICATION_PORT/actuator/mappings" private const val EXPECTED_NUMBER_OF_MESSAGES = 4 - private const val EXCLUDED_ENDPOINTS = "/health" + private const val EXCLUDED_ENDPOINTS = "'/health'" @JvmStatic @BeforeAll fun setUp() { From 1d3ced26819fb5b513208fd5568531f4ed2c2344 Mon Sep 17 00:00:00 2001 From: Samyak Gantayat Date: Wed, 12 Feb 2025 17:17:32 +0530 Subject: [PATCH 3/3] Excluded endpoints removed, config updated, filters added as well with specmatic version 2.4.0 --- build.gradle | 2 +- src/test/resources/specmatic.yaml | 32 +++++++++++++++---------------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/build.gradle b/build.gradle index 9f07639..49980b7 100644 --- a/build.gradle +++ b/build.gradle @@ -29,7 +29,7 @@ jacocoTestReport { } } -def specmatic_version = "2.3.0" +def specmatic_version = "2.4.0" dependencies { implementation platform('org.springframework.boot:spring-boot-dependencies:3.4.0') diff --git a/src/test/resources/specmatic.yaml b/src/test/resources/specmatic.yaml index 9a6e340..a9714ad 100644 --- a/src/test/resources/specmatic.yaml +++ b/src/test/resources/specmatic.yaml @@ -1,23 +1,17 @@ -sources: - - provider: git - repository: https://github.com/znsio/specmatic-order-contracts.git +--- +version: 2 +contracts: + - git: + url: "https://github.com/znsio/specmatic-order-contracts.git" provides: - - io/specmatic/examples/store/openapi/product_search_bff_v4.yaml + - "io/specmatic/examples/store/openapi/product_search_bff_v4.yaml" consumes: - - io/specmatic/examples/store/openapi/api_order_v3.yaml - - io/specmatic/examples/store/asyncapi/kafka.yaml - -examples: - - "src/test/resources/bff" - -test: - resiliencyTests: - enable: all - + - "io/specmatic/examples/store/openapi/api_order_v3.yaml" + - "io/specmatic/examples/store/asyncapi/kafka.yaml" report: formatters: - - type: text - layout: table + - type: "text" + layout: "table" types: APICoverage: OpenAPI: @@ -25,4 +19,8 @@ report: minThresholdPercentage: 70 maxMissedEndpointsInSpec: 0 enforce: true - +test: + resiliencyTests: + enable: "all" +examples: + - "src/test/resources/bff"