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

feat: update content_type_matching logic for binary payloads #429

Merged
merged 7 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion .github/workflows/build-ffi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
fail-fast: false
matrix:
operating-system: [ ubuntu-latest, windows-latest, macos-12 ]
operating-system: [ ubuntu-latest, windows-latest, macos-12, macos-14 ]
rust: [ stable ]
env:
pact_do_not_track: true
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ jobs:
build:
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: false
matrix:
operating-system: [ ubuntu-latest, windows-latest, macos-12 ]
operating-system: [ ubuntu-latest, windows-latest, macos-12, macos-14 ]
rust: [ stable ]
env:
pact_do_not_track: true
Expand Down
106 changes: 98 additions & 8 deletions compatibility-suite/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 38 additions & 18 deletions rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion rust/pact_consumer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ itertools = "0.12.1"
lazy_static = "1.4.0"
maplit = "1.0.2"
pact_matching = { version = "~1.2.2", path = "../pact_matching", default-features = false }
pact_mock_server = { version = "~1.2.6", default-features = false }
pact_mock_server = { version = "=1.2.8", default-features = false, git = "https://github.com/you54f/pact-core-mock-server.git", branch = "main" }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please update to released pact_mock_server, when pact_matching is released, and pact_mock_server updated to reference released crate

pact_models = { version = "~1.2.0", default-features = false }
pact-plugin-driver = { version = "~0.6.1", optional = true, default-features = false }
regex = "1.10.4"
Expand Down
3 changes: 2 additions & 1 deletion rust/pact_ffi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ maplit = "1.0.2"
multipart = { version = "0.18.0", default-features = false, features = ["client", "mock"] }
onig = { version = "6.4.0", default-features = false }
pact_matching = { version = "~1.2.2", path = "../pact_matching" }
pact_mock_server = { version = "~1.2.6" }
pact_mock_server = { version = "=1.2.8", git = "https://github.com/you54f/pact-core-mock-server.git", branch = "main" }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please update to released pact_mock_server, when pact_matching is released, and pact_mock_server updated to reference released crate

# pact_mock_server = { version = "=1.2.8", path = "../../../pact-core-mock-server/pact_mock_server" }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

path useful for dev guidelines if users are working across both repos locally.

.
├── pact-core-mock-server
└── pact-reference

pact_models = { version = "~1.2.0" }
pact-plugin-driver = { version = "~0.6.1" }
pact_verifier = { version = "~1.2.1", path = "../pact_verifier" }
Expand Down
2 changes: 1 addition & 1 deletion rust/pact_ffi/src/matching.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,6 @@ mod tests {
];

#[test_log::test]
#[cfg(not(windows))]
fn pactffi_matches_binary_value_test() {
let rule = MatchingRule::ContentType("image/gif".to_string());
let rule_ptr = &rule as *const MatchingRule;
Expand All @@ -363,6 +362,7 @@ mod tests {
let rule_ptr = &rule as *const MatchingRule;
let err_result = pactffi_matches_binary_value(rule_ptr, value, 35, value, 35, 0);
let string = unsafe { CString::from_raw(err_result as *mut c_char) };

expect!(string.to_string_lossy()).to(be_equal_to("Expected binary contents to have content type 'image/png' but detected contents was 'image/gif'"));
}

Expand Down
2 changes: 1 addition & 1 deletion rust/pact_ffi/tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,6 @@ fn fixture_path(path: &str) -> PathBuf {
.to_owned()
}

#[cfg(not(windows))]
#[rstest(
specification, expected_value,
case::specification_unknown(PactSpecification::Unknown, false),
Expand Down Expand Up @@ -695,6 +694,7 @@ fn pactffi_with_binary_file_feature_test(specification: PactSpecification, expec
CStr::from_ptr(pactffi_mock_server_mismatches(port)).to_string_lossy().into_owned()
};

println!("pactffi_with_binary_file_feature_test v{}: {}", specification, mismatches);
match result {
Ok(res) => {
let status = res.status();
Expand Down
Loading
Loading