-
Notifications
You must be signed in to change notification settings - Fork 51
Open
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behavior
Description
🌎 Environment
- Platform:
pact_ffi - Version/Release:
0.4.25 - Pact spec:
v3,v4 - FFI used:
bool pactffi_with_query_parameter_v2(
InteractionHandle interaction,
const char *name,
size_t index,
const char *value
);💬 Description
Setting up unit tests for PactSwift verifying various query parameter usage for Include matcher type.
QueryMismatch: Unable to match ["sub"] using Include("sub")
Expected: ["sub"]
Actual: ["substring"]
Parameter: $.item])"
🦶 Reproduction Steps
Steps to reproduce the behaviour:
- Setup a pact interaction that expects a query parameter,
- Set query parameter with string value that would include the substring defined in ‘Include’ matcher,
- Set query parameter’s matching rule
"{\"pact:matcher:type\":\"include\",\"value\":\"sub\"}" - Trigger
GET /endpoint?item=substring, - Verify pact interaction.
🤔 Expected Results
Pact test should succeed when GET request’s query parameters’ value contains the substring defined in Include matcher.
😲 Actual Results
Pact test fails stating:
QueryMismatch: Unable to match ["sub"] using Include("sub")
Expected: ["sub"]
Actual: ["substring"]
Parameter: $.item])"
🌳 Logs
...
RefCell {
value: PactHandleInner {
pact: V4Pact {
consumer: Consumer { name: "Consumer" },
provider: Provider { name: "Provider" },
interactions: [
SynchronousHttp {
id: None,
key: None,
description: "an interaction with query item matcher 'includes'",
provider_states: [],
request: HttpRequest {
method: "GET",
path: "/interaction",
query: Some({"item": [Some("sub")]}),
headers: None,
body: Missing,
matching_rules: MatchingRules {
rules: {
PATH: MatchingRuleCategory { name: PATH, rules: {} },
QUERY: MatchingRuleCategory { name: QUERY, rules: {
DocPath {
path_tokens: [Root, Field("item")],
expr: "$.item"
}:
RuleList {
rules: [Include("sub")],
rule_logic: And,
cascaded: false
}
}
}
}
},
generators: Generators { categories: {} } },
response: HttpResponse {
status: 200,
headers: None,
body: Missing,
matching_rules: MatchingRules { rules: {} },
generators: Generators { categories: {} } },
comments: {},
pending: false,
plugin_config: {},
interaction_markup: InteractionMarkup { markup: "", markup_type: "" },
transport: None
}
],
metadata: {
"namespace1": Object {"name1": String("value1")},
"namespace2": Object {"name2": String("value2")},
"pactRust": Object {"ffi": String("0.4.25")}
},
plugin_data: []
},
mock_server_started: true,
specification_version: V4
}
}
...
----------------------------------------------------------------------------------------
method: GET
path: /interaction
query: Some({"item": [Some("substring")]})
headers: Some({"accept-language": ["en-AU", "en;q=0.9"], "user-agent": ["xctest/23600 CFNetwork/1568.300.101 Darwin/24.2.0"], "host": ["127.0.0.1:4658"], "accept-encoding": ["gzip", "deflate"], "connection": ["keep-alive"], "accept": ["*/*"]})
body: Empty
----------------------------------------------------------------------------------------
...
QueryMismatch: Unable to match ["sub"] using Include("sub")
Expected: ["sub"]
Actual: ["substring"]
Parameter: $.item])"
...
📄 Stack Traces
See attached query-param-include-matcher-issue.log for full standardOut: .trace log:
query-param-include-matcher-issue.log
🤝 Relationships
- Related PRs or Issues:
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behavior