Closed rholshausen closed 1 year ago
From: https://github.com/pact-foundation/pact-js/issues/745
Can anyone confirm that matching rules are supported for metadata? I'm struggling to get the matching rules for metadata for an asynchronous message (Pact V4) working. The Pact file properly inculdes matching rules for the metadata, e.g.:
{ "consumer": { "name": "test" }, "interactions": [ { "matchingRules": { "metadata": { "Insert-Time": { "combine": "AND", "matchers": [ { "match": "type" } ] }, }, "metadata": { "Insert-Time": { "combine": "AND", "matchers": [ { "match": "type" } ] } } }, "metadata": { "Correlation-Id": "bc0c3b06-2123-4824-a866-25767a060249", "Insert-Time": "2022-05-26T06:34:24.123Z", "Tenant-Id": "CIR7nQwtS0rA6t0S6ejd", "contentType": "application/json" },
But somehow the log states (running it with TRACE as the log level) there is no matching rule defined and it fall back to an equality check:
2022-12-07T14:07:34.829777Z TRACE ThreadId(02) pactffi_verifier_execute{handle=0x128e1d4d0}:verify_interaction{interaction="test"}: pact_models::matchingrules: matcher_is_defined: for category metadata and path ["Insert-Time"] -> false 2022-12-07T14:07:34.829780Z DEBUG ThreadId(02) pactffi_verifier_execute{handle=0x128e1d4d0}:verify_interaction{interaction="test"}: pact_matching::json: JSON -> JSON: Comparing '"2022-05-26T06:34:24.123Z"' to '"2022-12-07T14:07:34.807Z"' using Equality -> Err(Expected '2022-05-26T06:34:24.123Z' to be equal to '2022-12-07T14:07:34.807Z')
The Pact is created with Pact JVM 4.4.1 and the provider is using Pact-JS 10.2.2
/jira ticket
👋 Thanks, Jira [PACT-512] ticket created.
From: https://github.com/pact-foundation/pact-js/issues/745
Can anyone confirm that matching rules are supported for metadata? I'm struggling to get the matching rules for metadata for an asynchronous message (Pact V4) working. The Pact file properly inculdes matching rules for the metadata, e.g.:
{ "consumer": { "name": "test" }, "interactions": [ { "matchingRules": { "metadata": { "Insert-Time": { "combine": "AND", "matchers": [ { "match": "type" } ] }, }, "metadata": { "Insert-Time": { "combine": "AND", "matchers": [ { "match": "type" } ] } } }, "metadata": { "Correlation-Id": "bc0c3b06-2123-4824-a866-25767a060249", "Insert-Time": "2022-05-26T06:34:24.123Z", "Tenant-Id": "CIR7nQwtS0rA6t0S6ejd", "contentType": "application/json" },
But somehow the log states (running it with TRACE as the log level) there is no matching rule defined and it fall back to an equality check:
2022-12-07T14:07:34.829777Z TRACE ThreadId(02) pactffi_verifier_execute{handle=0x128e1d4d0}:verify_interaction{interaction="test"}: pact_models::matchingrules: matcher_is_defined: for category metadata and path ["Insert-Time"] -> false 2022-12-07T14:07:34.829780Z DEBUG ThreadId(02) pactffi_verifier_execute{handle=0x128e1d4d0}:verify_interaction{interaction="test"}: pact_matching::json: JSON -> JSON: Comparing '"2022-05-26T06:34:24.123Z"' to '"2022-12-07T14:07:34.807Z"' using Equality -> Err(Expected '2022-05-26T06:34:24.123Z' to be equal to '2022-12-07T14:07:34.807Z')
The Pact is created with Pact JVM 4.4.1 and the provider is using Pact-JS 10.2.2