Skip to content

Instantly share code, notes, and snippets.

@shishkin
Created June 6, 2024 09:23
Show Gist options
  • Save shishkin/c596f6219dec0c792476702161ece3ae to your computer and use it in GitHub Desktop.
Save shishkin/c596f6219dec0c792476702161ece3ae to your computer and use it in GitHub Desktop.
Pact verifier issue
> vitest --run provider
[17:12:08.579] DEBUG (31565): pact@12.5.2: non-local provider address https://.../api detected, setting 'changeOrigin' to 'true'. This property can be overridden.
[17:12:08.581] INFO (31565): pact@12.5.2: Verifying provider
[17:12:08.584] INFO (31565): pact@12.5.2: debug request/response logging enabled
[17:12:08.587] INFO (31565): pact-core@14.3.6: Verifying Pacts.
[17:12:08.587] INFO (31565): pact-core@14.3.6: Verifying Pact Files
[17:12:08.588] DEBUG (31565): pact-core@14.3.6: Initalising native core at log level 'debug'
[17:12:08.588] DEBUG (31565): pact-core@14.3.6: binding path #0: : attempting to load native module from:
- /.../node_modules/@pact-foundation/pact-core/prebuilds/darwin-arm64
source: pact-js-core binding lookup
- You can override via PACT_PREBUILD_LOCATION
[17:12:08.591] INFO (31565): 0.4.20: pact native library successfully found, and the correct version
2024-06-06T09:12:08.591919Z DEBUG ThreadId(01) pact_ffi::verifier: pact_ffi::verifier::pactffi_verifier_new_for_application FFI function invoked
2024-06-06T09:12:08.592104Z DEBUG ThreadId(01) pact_ffi::verifier: pact_ffi::verifier::pactffi_verifier_set_provider_info FFI function invoked
[17:12:08.592] DEBUG (31565): pact-core@14.3.6: the optional ffi function 'pactffiVerifierSetFilterInfo' was not executed as it had non-fatal validation errors: None of PACT_DESCRIPTION, PACT_PROVIDER_STATE or PACT_PROVIDER_NO_STATE were set in the environment
2024-06-06T09:12:08.592389Z DEBUG ThreadId(01) pact_ffi::verifier: pact_ffi::verifier::pactffi_verifier_set_provider_state FFI function invoked
2024-06-06T09:12:08.592412Z DEBUG ThreadId(01) pact_ffi::verifier: pact_ffi::verifier::pactffi_verifier_set_verification_options FFI function invoked
[17:12:08.592] DEBUG (31565): pact-core@14.3.6: the optional ffi function 'pactffiVerifierSetPublishOptions' was not executed as it had non-fatal validation errors: No publishVerificationResult option / PACT_BROKER_PUBLISH_VERIFICATION_RESULTS set, or no providerVersion option
[17:12:08.592] DEBUG (31565): pact-core@14.3.6: the optional ffi function 'pactffiVerifierSetConsumerFilters' was not executed as it had non-fatal validation errors: Either no consumerFilters option provided, or the array was empty
[17:12:08.592] DEBUG (31565): pact-core@14.3.6: the optional ffi function 'pactffiVerifierSetFailIfNoPactsFound' was not executed as it had non-fatal validation errors: No failIfNoPactsFound option provided
2024-06-06T09:12:08.593165Z DEBUG ThreadId(01) pact_ffi::verifier: pact_ffi::verifier::pactffi_verifier_add_custom_header FFI function invoked
[17:12:08.593] DEBUG (31565): pact-core@14.3.6: checking source type of given pactUrl: /.../pacts/pact.json
[17:12:08.593] DEBUG (31565): pact-core@14.3.6: adding /.../pacts/pact.json as File source
2024-06-06T09:12:08.594054Z DEBUG ThreadId(01) pact_ffi::verifier: pact_ffi::verifier::pactffi_verifier_add_file_source FFI function invoked
[17:12:08.594] DEBUG (31565): pact-core@14.3.6: the optional ffi function 'pactffiVerifierBrokerSourceWithSelectors' was not executed as it had non-fatal validation errors: No pactBrokerUrl option / PACT_BROKER_BASE_URL set, or no provider option set
[17:12:08.594] DEBUG (31565): pact-core@14.3.6: the optional ffi function 'pactffiVerifierAddProviderTransport' was not executed as it had non-fatal validation errors: No additional provider transports provided
2024-06-06T09:12:08.594540Z DEBUG ThreadId(02) pact_ffi::verifier: pact_ffi::verifier::pactffi_verifier_execute FFI function invoked
2024-06-06T09:12:08.594552Z DEBUG ThreadId(02) pact_ffi::verifier::handle: Pact source to verify = File(/.../pacts/pact.json)
2024-06-06T09:12:08.594863Z DEBUG ThreadId(02) pact_plugin_driver::catalogue_manager: Updated catalogue entries:
core/content-generator/binary
core/content-generator/json
core/content-matcher/json
core/content-matcher/multipart-form-data
core/content-matcher/text
core/content-matcher/xml
2024-06-06T09:12:08.594891Z DEBUG ThreadId(02) pact_plugin_driver::catalogue_manager: Updated catalogue entries:
core/matcher/v1-equality
core/matcher/v2-max-type
core/matcher/v2-min-type
core/matcher/v2-minmax-type
core/matcher/v2-regex
core/matcher/v2-type
core/matcher/v3-content-type
core/matcher/v3-date
core/matcher/v3-datetime
core/matcher/v3-decimal-type
core/matcher/v3-includes
core/matcher/v3-integer-type
core/matcher/v3-null
core/matcher/v3-number-type
core/matcher/v3-time
core/matcher/v4-array-contains
core/matcher/v4-equals-ignore-order
core/matcher/v4-max-equals-ignore-order
core/matcher/v4-min-equals-ignore-order
core/matcher/v4-minmax-equals-ignore-order
core/matcher/v4-not-empty
core/matcher/v4-semver
❯ src/provider.test.ts (1)
❯ CMS GraphQL Provider (1)
⠏ validates that provider fulfills the contract
❯ src/provider.test.ts (1)
❯ CMS GraphQL Provider (1)
⠇ validates that provider fulfills the contract
2024-06-06T09:12:08.914568Z DEBUG ThreadId(02) verify_interaction{interaction="ping query"}: pact_verifier::provider_client: Sending HTTP Request ( method: POST, path: /, query: None, headers: Some({"Content-Type": ["application/json"]}), body: Present(48 bytes, application/json) ) to state change handler
2024-06-06T09:12:08.914655Z DEBUG ThreadId(02) verify_interaction{interaction="ping query"}: hyper_util::client::legacy::connect::http: connecting to
❯ src/provider.test.ts (1)
❯ CMS GraphQL Provider (1)
⠏ validates that provider fulfills the contract
[17:12:08.921] DEBUG (31565): pact@12.5.2: incoming request: {"body":{"action":"setup","params":{},"state":"Default"},"headers":{"content-type":"application/json","accept":"*/*","authorization":"Bearer y0JEMq8LUbNJdKfeclaKnrBR4MdZoGq_","accept-encoding":"gzip, zstd, deflate","host":"127.0.0.1:49624","content-length":"48"},"method":"POST","path":"/_pactSetup"}
[17:12:08.922] DEBUG (31565): pact@12.5.2: setting up state '{"action":"setup","params":{},"state":"Default"}'
[17:12:08.922] DEBUG (31565): pact@12.5.2: setting up state 'Default'
[17:12:08.923] DEBUG (31565): pact@12.5.2: outgoing response: {"body":"{\"description\":\"OK\"}","headers":{"x-powered-by":"Express","content-type":"application/json; charset=utf-8","content-length":"20","etag":"W/\"14-0OCXKQKXV/oeWDmoOZ34dullmjA\""},"status":200}
2024-06-06T09:12:08.924781Z DEBUG ThreadId(02) verify_interaction{interaction="ping query"}: hyper_util::client::legacy::pool: pooling idle connection for ("http", 127.0.0.1:49624)
2024-06-06T09:12:08.924796Z DEBUG ThreadId(02) verify_interaction{interaction="ping query"}: pact_verifier::provider_client: State change request: Response { url: Url { scheme: "http", cannot_be_a_base: false, username: "", password: None, host: Some(Ipv4(127.0.0.1)), port: Some(49624), path: "/_pactSetup", query: None, fragment: None }, status: 200, headers: {"x-powered-by": "Express", "content-type": "application/json; charset=utf-8", "content-length": "20", "etag": "W/\"14-0OCXKQKXV/oeWDmoOZ34dullmjA\"", "date": "Thu, 06 Jun 2024 09:12:08 GMT", "connection": "keep-alive", "keep-alive": "timeout=5"} }
2024-06-06T09:12:08.924845Z DEBUG ThreadId(02) verify_interaction{interaction="ping query"}: pact_verifier: State Change: "ProviderState { name: "Default", params: {} }" -> Ok({"description": String("OK")})
2024-06-06T09:12:08.924859Z INFO ThreadId(02) verify_interaction{interaction="ping query"}: pact_verifier: Running provider verification for 'ping query'
2024-06-06T09:12:08.924866Z DEBUG ThreadId(02) verify_interaction{interaction="ping query"}: pact_verifier: Verifying a HTTP interaction
2024-06-06T09:12:08.924883Z INFO ThreadId(02) verify_interaction{interaction="ping query"}: pact_verifier::provider_client: Sending request to provider at http://127.0.0.1:49624/
2024-06-06T09:12:08.924885Z DEBUG ThreadId(02) verify_interaction{interaction="ping query"}: pact_verifier::provider_client: Provider details = ProviderInfo { name: "provider", protocol: "http", host: "127.0.0.1", port: Some(49624), path: "/", transports: [ProviderTransport { transport: "http", port: Some(49624), path: Some("/"), scheme: None }] }
2024-06-06T09:12:08.924891Z INFO ThreadId(02) verify_interaction{interaction="ping query"}: pact_verifier::provider_client: Sending request HTTP Request ( method: POST, path: /, query: None, headers: Some({"Content-Type": ["application/json"]}), body: Present(58 bytes, application/json) )
2024-06-06T09:12:08.924895Z DEBUG ThreadId(02) verify_interaction{interaction="ping query"}: pact_verifier::provider_client: body:
{"operationName":"ping","query":"query ping {\n ping\n}"}
2024-06-06T09:12:08.924916Z DEBUG ThreadId(02) verify_interaction{interaction="ping query"}: hyper_util::client::legacy::pool: reuse idle connection for ("http", 127.0.0.1:49624)
[17:12:08.925] DEBUG (31565): pact@12.5.2: incoming request: {"body":{"operationName":"ping","query":"query ping {\n ping\n}"},"headers":{"content-ty
❯ src/provider.test.ts (1)
❯ CMS GraphQL Provider (1)
⠹ validates that provider fulfills the contract
[17:12:11.357] DEBUG (31565): pact@12.5.2: outgoing response: {"body":"\u001f�\b\u0000\u0000\u0000\u0000\u0000\u0000\u0003�VJI,IT��V*��KW�R*�\u0007R��\u0000\u0017x\u0004�\u0018\u0000\u0000\u0000","headers":{"x-powered-by":"Craft CMS","server":"nginx","date":"Thu, 06 Jun 2024 09:12:11 GMT","content-type":"application/json; charset=UTF-8","content-length":"42","connection":"close","access-control-allow-credentials":"true","access-control-allow-headers":"Authorization, Content-Type, X-Craft-Authorization, X-Craft-Token","access-control-allow-origin":"*","vary":"Authorization,Accept-Encoding","content-encoding":"gzip"},"status":200}
2024-06-06T09:12:11.357787Z DEBUG ThreadId(02) verify_interaction{interaction="ping query"}: pact_verifier::provider_client: Received native response: Response { url: Url { scheme: "http", cannot_be_a_base: false, username: "", password: None, host: Some(Ipv4(127.0.0.1)), port: Some(49624), path: "/", query: None, fragment: None }, status: 200, headers: {"x-powered-by": "Craft CMS", "server": "nginx", "date": "Thu, 06 Jun 2024 09:12:11 GMT", "content-type": "application/json; charset=UTF-8", "vary": "Authorization,Accept-Encoding", "connection": "close", "access-control-allow-credentials": "true", "access-control-allow-headers": "Authorization, Content-Type, X-Craft-Authorization, X-Craft-Token", "access-control-allow-origin": "*"} }
2024-06-06T09:12:11.357846Z INFO ThreadId(02) verify_interaction{interaction="ping query"}: pact_verifier::provider_client: Received response: HTTP Response ( status: 200, headers: Some({"access-control-allow-credentials": ["true"], "access-control-allow-headers": ["Authorization", "Content-Type", "X-Craft-Authorization", "X-Craft-Token"], "content-type": ["application/json; charset=UTF-8"], "access-control-allow-origin": ["*"], "server": ["nginx"], "x-powered-by": ["Craft CMS"], "date": ["Thu, 06 Jun 2024 09:12:11 GMT"], "vary": ["Authorization", "Accept-Encoding"], "connection": ["close"]}), body: Present(24 bytes, application/json;charset=utf-8) )
2024-06-06T09:12:11.357857Z DEBUG ThreadId(02) verify_interaction{interaction="ping query"}: pact_verifier::provider_client: body:
{"data":{"ping":"pong"}}
2024-06-06T09:12:11.357870Z INFO ThreadId(02) verify_interaction{interaction="ping query"}: pact_matching: comparing to expected response: HTTP Response ( status: 200, headers: Some({"Content-Type": ["application/json; charset=utf-8"]}), body: Present(24 bytes, application/json) )
2024-06-06T09:12:11.357890Z DEBUG ThreadId(02) verify_interaction{interaction="ping query"}: pact_matching: expected content type = 'application/json', actual content type = 'application/json;charset=utf-8'
2024-06-06T09:12:11.357994Z DEBUG ThreadId(02) verify_interaction{interaction="ping query"}: pact_matching: content type header matcher = 'RuleList { rules: [], rule_logic: And, cascaded: false }'
2024-06-06T09:12:11.358007Z DEBUG ThreadId(02) verify_interaction{interaction="ping query"}: pact_plugin_driver::catalogue_manager: Looking for a content matcher for application/json
2024-06-06T09:12:11.358167Z DEBUG ThreadId(02) verify_interaction{interaction="ping query"}: pact_matching: No content matcher defined for content type 'application/json', using core matcher implementation
2024-06-06T09:12:11.358172Z DEBUG ThreadId(02) verify_interaction{interaction="ping query"}: pact_matching: Using body matcher for content type 'application/json'
2024-06-06T09:12:11.358181Z DEBUG ThreadId(02) verify_interaction{interaction="ping query"}: pact_matching::json: compare: Comparing path $
2024-06-06T09:12:11.358185Z DEBUG ThreadId(02) verify_interaction{interaction="ping query"}: pact_matching::json: compare_maps: Comparing maps at $: {"data": Object {"ping": String("pong")}} -> {"data": Object {"ping": String("pong")}}
2024-06-06T09:12:11.358212Z DEBUG ThreadId(02) verify_interaction{interaction="ping query"}: pact_matching::json: compare: Comparing path $.data
2024-06-06T09:12:11.358215Z DEBUG ThreadId(02) verify_interaction{interaction="ping query"}: pact_matching::json: compare_maps: Comparing maps at $.data: {"ping": String("pong")} -> {"ping": String("pong")}
2024-06-06T09:12:11.358219Z DEBUG ThreadId(02) verify_interaction{interaction="ping query"}: pact_matching::json: compare: Comparing path $.data.ping
2024-06-06T09:12:11.358222Z DEBUG ThreadId(02) verify_interaction{interaction="ping query"}: pact_matching::json: JSON -> JSON: Comparing '"pong"' to '"pong"' using Equality -> Ok(())
2024-06-06T09:12:11.358225Z DEBUG ThreadId(02) verify_interaction{interaction="ping query"}: pact_matching::json: compare_values: Comparing 'String("p
❯ src/provider.test.ts (1)
❯ CMS GraphQL Provider (1)
⠙ validates that provider fulfills the contract
2024-06-06T09:12:11.516078Z DEBUG ThreadId(02) verify_interaction{interaction="ping query"}: pact_verifier::provider_client: Sending HTTP Request ( method: POST, path: /, query: None, headers: Some({"Content-Type": ["application/json"]}), body: Present(51 bytes, application/json) ) to state change handler
2024-06-06T09:12:11.516134Z DEBUG ThreadId(02) verify_interaction{interaction="ping query"}: hyper_util::client::legacy::connect::http: connecting to 127.0.0.1:49624
2024-06-06T09:12:11.516483Z DEBUG ThreadId(02) verify_interaction{interaction="ping query"}: hyper_util::client::legacy::connect::http: connected to 127.0.0.1:49624
[17:12:11.517] DEBUG (31565): pact@12.5.2: incoming request: {"body":{"action":"teardown","params":{},"state":"Default"},"headers":{"content-type":"application/json","accept":"*/*","authorization":"Bearer y0JEMq8LUbNJdKfeclaKnrBR4MdZoGq_","accept-encoding":"gzip, zstd, deflate","host":"127.0.0.1:49624","content-length":"51"},"method":"POST","path":"/_pactSetup"}
[17:12:11.517] DEBUG (31565): pact@12.5.2: setting up state '{"action":"teardown","params":{},"state":"Default"}'
[17:12:11.517] DEBUG (31565): pact@12.5.2: outgoing response: {"headers":{"x-powered-by":"Express","content-type":"application/json; charset=utf-8"},"status":200}
2024-06-06T09:12:11.518024Z DEBUG ThreadId(02) verify_interaction{interaction="ping query"}: hyper_util::client::legacy::pool: pooling idle connection for ("http", 127.0.0.1:49624)
2024-06-06T09:12:11.518042Z DEBUG ThreadId(02) verify_interaction{interaction="ping query"}: pact_verifier::provider_client: State change request: Response { url: Url { scheme: "http", cannot_be_a_base: false, username: "", password: None, host: Some(Ipv4(127.0.0.1)), port: Some(49624), path: "/_pactSetup", query: None, fragment: None }, status: 200, headers: {"x-powered-by": "Express", "content-type": "application/json; charset=utf-8", "date": "
❯ src/provider.test.ts (1)
❯ CMS GraphQL Provider (1)
⠋ validates that provider fulfills the contract
❯ src/provider.test.ts (1)
❯ CMS GraphQL Provider (1)
⠏ validates that provider fulfills the contract
2024-06-06T09:12:11.828644Z DEBUG ThreadId(02) verify_interaction{interaction="ping query 3"}: pact_verifier::provider_client: Sending HTTP Request ( method: POST, path: /, query: None, headers: Some({"Content-Type": ["application/json"]}), body: Present(48 bytes, application/json) ) to state change handler
2024-06-06T09:12:11.828706Z DEBUG ThreadId(02) verify_interaction{interaction="ping query 3"}: hyper_util::client::legacy::connect::http: connecting to 127.0.0.1:49624
2024-06-06T09:12:11.829053Z DEBUG ThreadId(02) verify_interaction{interaction="ping query 3"}: hyper_util::client::legacy::connect::http: connected to 127.0.0.1:49624
[17:12:11.829] DEBUG (31565): pact@12.5.2: incoming request: {"body":{"action":"setup","params":{},"state":"Default"},"headers":{"content-type":"application/json","accept":"*/*","authorization":"Bearer y0JEMq8LUbNJdKfeclaKnrBR4MdZoGq_","accept-encoding":"gzip, zstd, deflate","host":"127.0.0.1:49624","content-length":"48"},"method":"POST","path":"/_pactSetup"}
[17:12:11.829] DEBUG (31565): pact@12.5.2: setting up state '{"action":"setup","params":{},"state":"Default"}'
[17:12:11.830] DEBUG (31565): pact@12.5.2: setting up state 'Default'
[17:12:11.830] DEBUG (31565): pact@12.5.2: outgoing response: {"body":"{\"description\":\"OK\"}","headers":{"x-powered-by":"Express","content-type":"application/json; charset=utf-8","content-length":"20","etag":"W/\"14-0OCXKQKXV/oeWDmoOZ34dullmjA\""},"status":200}
2024-06-06T09:12:11.830698Z DEBUG ThreadId(02) verify_interaction{interaction="ping query 3"}: hyper_util::client::legacy::pool: pooling idle connection for ("http", 127.0.0.1:49624)
2024-06-06T09:12:11.830708Z DEBUG ThreadId(02) verify_interaction{interaction="ping query 3"}: pact_verifier::provider_client: State change request: Response { url: Url { scheme: "http", cannot_be_a_base: false, username: "", password: None, host: Some(Ipv4(127.0.0.1)), port: Some(49624), path: "/_pactSetup", query: None, fragment: None }, status: 200, headers: {"x-powered-by": "Express", "content-type": "application/json; charset=utf-8", "content-length": "20", "etag": "W/\"14-0OCXKQKXV/oeWDmoOZ34dullmjA\"", "date": "Thu, 06 Jun 2024 09:12:11 GMT", "connection": "keep-alive", "keep-alive": "timeout=5"} }
2024-06-06T09:12:11.830746Z DEBUG ThreadId(02) verify_interaction{interaction="ping query 3"}: pact_verifier: State Change: "ProviderState { name: "Default", params: {} }" -> Ok({"description": String("OK")})
2024-06-06T09:12:11.830757Z INFO ThreadId(02) verify_interaction{interaction="ping query 3"}: pact_verifier: Running provider verification for 'ping query 3'
2024-06-06T09:12:11.830765Z DEBUG ThreadId(02) verify_interaction{interaction="ping query 3"}: pact_verifier: Verifying a HTTP interaction
2024-06-06T09:12:11.830777Z INFO ThreadId(02) verify_interaction{interaction="ping query 3"}: pact_verifier::provider_client: Sending request to provider at http://127.0.0.1:49624/
2024-06-06T09:12:11.830781Z DEBUG ThreadId(02) verify_interaction{interaction="ping query 3"}: pact_verifier::provider_client: Provider details = ProviderInfo { name: "provider", protocol: "http", host: "127.0.0.1", port: Some(49624), path: "/", transports: [ProviderTransport { transport: "http", port: Some(49624), path: Some("/"), scheme: None }] }
2024-06-06T09:12:11.830785Z INFO ThreadId(02) verify_interaction{interaction="ping query 3"}: pact_verifier::provider_client: Sending request HTTP Request ( method: POST, path: /, query: None, headers: Some({"Content-Type": ["application/json"]}), body: Present(58 bytes, application/json) )
2024-06-06T09:12:11.830789Z DEBUG ThreadId(02) verify_interaction{interaction="ping query 3"}: pact_verifier::provider_client: body:
❯ src/provider.test.ts (1)
❯ CMS GraphQL Provider (1)
⠋ validates that provider fulfills the contract
[17:12:11.831] DEBUG (31565): pact@12.5.2: incoming request: {"body":{"operationName":"ping","query":"query ping {\n ping\n}"},"headers":{"content-ty
❯ src/provider.test.ts (1)
❯ CMS GraphQL Provider (1)
⠋ validates that provider fulfills the contract
[17:12:13.199] DEBUG (31565): pact@12.5.2: outgoing response: {"body":"\u001f�\b\u0000\u0000\u0000\u0000\u0000\u0000\u0003�VJI,IT��V*��KW�R*�\u0007R��\u0000\u0017x\u0004�\u0018\u0000\u0000\u0000","headers":{"x-powered-by":"Craft CMS","server":"nginx","date":"Thu, 06 Jun 2024 09:12:12 GMT","content-type":"application/json; charset=UTF-8","content-length":"42","connection":"close","access-control-allow-credentials":"true","access-control-allow-headers":"Authorization, Content-Type, X-Craft-Authorization, X-Craft-Token","access-control-allow-origin":"*","vary":"Authorization,Accept-Encoding","content-encoding":"gzip"},"status":200}
2024-06-06T09:12:13.200280Z DEBUG ThreadId(02) verify_interaction{interaction="ping query 3"}: pact_verifier::provider_client: Received native response: Response { url: Url { scheme: "http", cannot_be_a_base: false, username: "", password: None, host: Some(Ipv4(127.0.0.1)), port: Some(49624), path: "/", query: None, fragment: None }, status: 200, headers: {"x-powered-by": "Craft CMS", "server": "nginx", "date": "Thu, 06 Jun 2024 09:12:12 GMT", "content-type": "application/json; charset=UTF-8", "vary": "Authorization,Accept-Encoding", "connection": "close", "access-control-allow-credentials": "true", "access-control-allow-headers": "Authorization, Content-Type, X-Craft-Authorization, X-Craft-Token", "access-control-allow-origin": "*"} }
2024-06-06T09:12:13.200340Z INFO ThreadId(02) verify_interaction{interaction="ping query 3"}: pact_verifier::provider_client: Received response: HTTP Response ( status: 200, headers: Some({"access-control-allow-origin": ["*"], "server": ["nginx"], "date": ["Thu, 06 Jun 2024 09:12:12 GMT"], "x-powered-by": ["Craft CMS"], "connection": ["close"], "vary": ["Authorization", "Accept-Encoding"], "content-type": ["application/json; charset=UTF-8"], "access-control-allow-credentials": ["true"], "access-control-allow-headers": ["Authorization", "Content-Type", "X-Craft-Authorization", "X-Craft-Token"]}), body: Present(24 bytes, application/json;charset=utf-8) )
2024-06-06T09:12:13.200353Z DEBUG ThreadId(02) verify_interaction{interaction="ping query 3"}: pact_verifier::provider_client: body:
{"data":{"ping":"pong"}}
2024-06-06T09:12:13.200362Z INFO ThreadId(02) verify_interaction{interaction="ping query 3"}: pact_matching: comparing to expected response: HTTP Response ( status: 200, headers: Some({"Content-Type": ["application/json; charset=utf-8"]}), body: Present(24 bytes, application/json) )
2024-06-06T09:12:13.200371Z DEBUG ThreadId(02) verify_interaction{interaction="ping query 3"}: pact_matching: expected content type = 'application/json', actual content type = 'application/json;charset=utf-8'
2024-06-06T09:12:13.200381Z DEBUG ThreadId(02) verify_interaction{interaction="ping query 3"}: pact_matching: content type header matcher = 'RuleList { rules: [], rule_logic: And, cascaded: false }'
2024-06-06T09:12:13.200385Z DEBUG ThreadId(02) verify_interaction{interaction="ping query 3"}: pact_plugin_driver::catalogue_manager: Looking for a content matcher for application/json
2024-06-06T09:12:13.200556Z DEBUG ThreadId(02) verify_interaction{interaction="ping query 3"}: pact_matching: No content matcher defined for content type 'application/json', using core matcher implementation
2024-06-06T09:12:13.200563Z DEBUG ThreadId(02) verify_interaction{interaction="ping query 3"}: pact_matching: Using body matcher for content type 'application/json'
2024-06-06T09:12:13.200568Z DEBUG ThreadId(02) verify_interaction{interaction="ping query 3"}: pact_matching::json: compare: Comparing path $
2024-06-06T09:12:13.200570Z DEBUG ThreadId(02) verify_interaction{interaction="ping query 3"}: pact_matching::json: compare_maps: Comparing maps at $: {"data": Object {"ping": String("pong")}} -> {"data": Object {"ping": String("pong")}}
2024-06-06T09:12:13.200623Z DEBUG ThreadId(02) verify_interaction{interaction="ping query 3"}: pact_matching::json: compare: Comparing path $.data
2024-06-06T09:12:13.200638Z DEBUG ThreadId(02) verify_interaction{interaction="ping query 3"}: pact_matching::json: compare_maps: Comparing maps at $.data: {"ping": String("pong")} -> {"ping": String("pong")}
2024-06-06T09:12:13.200646Z DEBUG ThreadId(02) verify_interaction{interaction="ping query 3"}: pact_matching::json: compare: Comparing path $.data.ping
2024-06-06T09:12:13.200649Z DEBUG ThreadId(02) verify_interaction{interaction="ping query 3"}: pact_matching::json: JSON -> JSON: Comparing '"pong"' to '"pong"' using Equality -> Ok(())
2024-06-06T09:12:13.200652Z DEBUG ThreadId(02) verify_interaction{interaction="ping query 3"}: pact_matching::json: compare_values: Comparing 'String(
❯ src/provider.test.ts (1)
❯ CMS GraphQL Provider (1)
⠏ validates that provider fulfills the contract
2024-06-06T09:12:13.358160Z DEBUG ThreadId(02) verify_interaction{interaction="ping query 3"}: pact_verifier::provider_client: Sending HTTP Request ( method: POST, path: /, query: None, headers: Some({"Content-Type": ["application/json"]}), body: Present(51 bytes, application/json) ) to state change handler
2024-06-06T09:12:13.358229Z DEBUG ThreadId(02) verify_interaction{interaction="ping query 3"}: hyper_util::client::legacy::connect::http: connecting to 127.0.0.1:49624
2024-06-06T09:12:13.358529Z DEBUG ThreadId(02) verify_interaction{interaction="ping query 3"}: hyper_util::client::legacy::connect::http: connected to 127.0.0.1:49624
[17:12:13.359] DEBUG (31565): pact@12.5.2: incoming request: {"body":{"action":"teardown","params":{},"state":"Default"},"headers":{"content-type":"application/json","accept":"*/*","authorization":"Bearer y0JEMq8LUbNJdKfeclaKnrBR4MdZoGq_","accept-encoding":"gzip, zstd, deflate","host":"127.0.0.1:49624","content-length":"51"},"method":"POST","path":"/_pactSetup"}
[17:12:13.359] DEBUG (31565): pact@12.5.2: setting up state '{"action":"teardown","params":{},"state":"Default"}'
[17:12:13.359] DEBUG (31565): pact@12.5.2: outgoing response: {"headers":{"x-powered-by":"Express","content-type":"application/json; charset=utf-8"},"status":200}
2024-06-06T09:12:13.359728Z DEBUG ThreadId(02) verify_interaction{interaction="ping query 3"}: hyper_util::client::legacy::pool: pooling idle connection for ("http", 127.0.0.1:49624)
2024-06-06T09:12:13.359738Z DEBUG ThreadId(02) verify_interaction{interaction="ping query 3"}: pact_verifier::provider_client: State change request: Response { url: Url { scheme: "http", cannot_be_a_base: false, username: "", password: None, host: Some(Ipv4(127.0.0.1)), port: Some(49624), path: "/_pactSetup", query: None, fragment: None }, status: 200, headers: {"x-powered-by": "Express", "content-type": "application/json; charset=utf-8", "date":
❯ src/provider.test.ts (1)
❯ CMS GraphQL Provider (1)
⠇ validates that provider fulfills the contract
❯ src/provider.test.ts (1) 5011ms
❯ CMS GraphQL Provider (1) 5011ms
× validates that provider fulfills the contract 5011ms
2024-06-06T09:12:13.667303Z DEBUG ThreadId(02) verify_interaction{interaction="ping query 2"}: pact_verifier::provider_client: Sending HTTP Request ( method: POST, path: /, query: None, headers: Some({"Content-Type": ["application/json"]}), body: Present(48 bytes, application/json) ) to state change handler
2024-06-06T09:12:13.667368Z DEBUG ThreadId(02) verify_interaction{interaction="ping query 2"}: hyper_util::client::legacy::connect::http: connecting to 127.0.0.1:49624
2024-06-06T09:12:13.667611Z DEBUG ThreadId(02) verify_interaction{interaction="ping query 2"}: pact_verifier::provider_client: State change request failed with error error sending request for url (http://127.0.0.1:49624/_pactSetup)
2024-06-06T09:12:13.667636Z DEBUG ThreadId(02) verify_interaction{interaction="ping query 2"}: pact_verifier: State Change: "ProviderState { name: "Default", params: {} }" -> Err(Provider state failed: Invalid response: error sending request for url (http://127.0.0.1:49624/_pactSetup))
2024-06-06T09:12:13.667643Z ERROR ThreadId(02) verify_interaction{interaction="ping query 2"}: pact_verifier: Provider setup state change for 'Default' has failed - MismatchResult::Error("Invalid response: error sending request for url (http://127.0.0.1:49624/_pactSetup)", None)
2024-06-06T09:12:13.667717Z DEBUG ThreadId(02) pact_matching::metrics: 'PACT_DO_NOT_TRACK' environment variable is set, will not send metrics
Verifying a pact between Portal and CraftCMS
ping query (0s loading, 2s 922ms verification)
Given Default
returns a response which
has status code 200 (OK)
includes headers
"Content-Type" with value "application/json; charset=utf-8" (OK)
has a matching body (OK)
ping query 3 (0s loading, 1s 841ms verification)
Given Default
returns a response which
has status code 200 (OK)
includes headers
"Content-Type" with value "application/json; charset=utf-8" (OK)
has a matching body (OK)
ping query 2 (0s loading, 307ms verification)
Given Default
Request Failed - One or more of the setup state change handlers has failed
Failures:
1) Verifying a pact between Portal and CraftCMS Given Default - ping query 2 - One or more of the setup state change handlers has failed
There were 1 pact failures
2024-06-06T09:12:13.667747Z DEBUG ThreadId(02) pact_plugin_driver::plugin_manager: Shutting down all plugins
libc++abi: terminating due to uncaught exception of type Napi::Error
fish: Job 1, 'GATEWAY_CMS_GQL_API_URL=https:/…' terminated by signal SIGABRT (Abort)
{
"consumer": {
"name": "Portal"
},
"interactions": [
{
"description": "ping query",
"pending": false,
"providerStates": [
{
"name": "Default"
}
],
"request": {
"body": {
"content": {
"operationName": "ping",
"query": "query ping {\n ping\n}"
},
"contentType": "application/json",
"encoded": false
},
"headers": {
"Content-Type": [
"application/json"
]
},
"method": "POST",
"path": "/"
},
"response": {
"body": {
"content": {
"data": {
"ping": "pong"
}
},
"contentType": "application/json",
"encoded": false
},
"headers": {
"Content-Type": [
"application/json; charset=utf-8"
]
},
"status": 200
},
"type": "Synchronous/HTTP"
},
{
"description": "ping query 3",
"pending": false,
"providerStates": [
{
"name": "Default"
}
],
"request": {
"body": {
"content": {
"operationName": "ping",
"query": "query ping {\n ping\n}"
},
"contentType": "application/json",
"encoded": false
},
"headers": {
"Content-Type": [
"application/json"
]
},
"method": "POST",
"path": "/"
},
"response": {
"body": {
"content": {
"data": {
"ping": "pong"
}
},
"contentType": "application/json",
"encoded": false
},
"headers": {
"Content-Type": [
"application/json; charset=utf-8"
]
},
"status": 200
},
"type": "Synchronous/HTTP"
},
{
"description": "ping query 2",
"pending": false,
"providerStates": [
{
"name": "Default"
}
],
"request": {
"body": {
"content": {
"operationName": "ping",
"query": "query ping {\n ping\n}"
},
"contentType": "application/json",
"encoded": false
},
"headers": {
"Content-Type": [
"application/json"
]
},
"method": "POST",
"path": "/"
},
"response": {
"body": {
"content": {
"data": {
"ping": "pong"
}
},
"contentType": "application/json",
"encoded": false
},
"headers": {
"Content-Type": [
"application/json; charset=utf-8"
]
},
"status": 200
},
"type": "Synchronous/HTTP"
}
],
"metadata": {
"pact-js": {
"version": "12.5.0"
},
"pactRust": {
"ffi": "0.4.20",
"models": "1.2.0"
},
"pactSpecification": {
"version": "4.0"
}
},
"provider": {
"name": "CraftCMS"
}
}
import "dotenv/config";
import { Verifier } from "@pact-foundation/pact";
import { describe, it } from "vitest";
import { fileURLToPath } from "url";
import assert from "node:assert";
describe("CMS GraphQL Provider", () => {
it("validates that provider fulfills the contract", async () => {
const verifier = new Verifier({
pactUrls: [
fileURLToPath(
new URL("../pacts/pact.json", import.meta.url),
),
],
providerBaseUrl: "...",
customProviderHeaders: {
Authorization: `Bearer ...`,
},
logLevel: "debug",
stateHandlers: {
Default: async () => {
return { description: "OK" };
},
},
});
const res = await verifier.verifyProvider();
console.log(res);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment