Skip to content

Commit

Permalink
Revert "feat(verifier): Add the verifier version to the published res…
Browse files Browse the repository at this point in the history
…ults #307"

This reverts commit 6962fce.
  • Loading branch information
rholshausen committed Feb 18, 2024
1 parent 6962fce commit 167c445
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 57 deletions.
2 changes: 0 additions & 2 deletions rust/pact_verifier/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@ pub mod metrics;
pub mod verification_result;
mod utils;

const VERIFIER_VERSION: &str = env!("CARGO_PKG_VERSION");

/// Source for loading pacts
#[derive(Debug, Clone)]
pub enum PactSource {
Expand Down
54 changes: 22 additions & 32 deletions rust/pact_verifier/src/pact_broker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ use tracing::{debug, error, info, trace, warn};
use pact_matching::Mismatch;

use crate::MismatchResult;
use crate::VERIFIER_VERSION;
use crate::utils::with_retries;

fn is_true(object: &serde_json::Map<String, Value>, field: &str) -> bool {
Expand Down Expand Up @@ -821,8 +820,7 @@ fn build_payload(result: TestResult, version: String, build_url: Option<String>)
"providerApplicationVersion": version,
"verifiedBy": {
"implementation": "Pact-Rust",
"version": PACT_RUST_VERSION,
"verifierVersion": VERIFIER_VERSION
"version": PACT_RUST_VERSION
}
});
let json_obj = json.as_object_mut().unwrap();
Expand Down Expand Up @@ -1084,7 +1082,6 @@ mod tests {
use pact_models::{Consumer, PactSpecification, Provider};
use pact_models::prelude::RequestResponsePact;
use pact_models::sync_interaction::RequestResponseInteraction;
use pretty_assertions::assert_eq;

use pact_consumer::*;
use pact_consumer::prelude::*;
Expand Down Expand Up @@ -2022,40 +2019,38 @@ mod tests {
fn test_build_payload_with_success() {
let result = TestResult::Ok(vec![]);
let payload = super::build_payload(result, "1".to_string(), None);
assert_eq!(payload, json!({
expect!(payload).to(be_equal_to(json!({
"providerApplicationVersion": "1",
"success": true,
"testResults": [],
"verifiedBy": {
"implementation": "Pact-Rust",
"version": PACT_RUST_VERSION,
"verifierVersion": VERIFIER_VERSION
"version": PACT_RUST_VERSION
}
}));
})));
}

#[test]
fn test_build_payload_adds_the_build_url_if_provided() {
let result = TestResult::Ok(vec![]);
let payload = super::build_payload(result, "1".to_string(), Some("http://build-url".to_string()));
assert_eq!(payload, json!({
expect!(payload).to(be_equal_to(json!({
"providerApplicationVersion": "1",
"success": true,
"buildUrl": "http://build-url",
"testResults": [],
"verifiedBy": {
"implementation": "Pact-Rust",
"version": PACT_RUST_VERSION,
"verifierVersion": VERIFIER_VERSION
"version": PACT_RUST_VERSION
}
}));
})));
}

#[test]
fn test_build_payload_adds_a_result_for_each_interaction() {
let result = TestResult::Ok(vec![Some("1".to_string()), Some("2".to_string()), Some("3".to_string()), None]);
let payload = super::build_payload(result, "1".to_string(), Some("http://build-url".to_string()));
assert_eq!(payload, json!({
expect!(payload).to(be_equal_to(json!({
"providerApplicationVersion": "1",
"success": true,
"buildUrl": "http://build-url",
Expand All @@ -2066,26 +2061,24 @@ mod tests {
],
"verifiedBy": {
"implementation": "Pact-Rust",
"version": PACT_RUST_VERSION,
"verifierVersion": VERIFIER_VERSION
"version": PACT_RUST_VERSION
}
}));
})));
}

#[test]
fn test_build_payload_with_failure() {
let result = TestResult::Failed(vec![]);
let payload = super::build_payload(result, "1".to_string(), None);
assert_eq!(payload, json!({
expect!(payload).to(be_equal_to(json!({
"providerApplicationVersion": "1",
"success": false,
"testResults": [],
"verifiedBy": {
"implementation": "Pact-Rust",
"version": PACT_RUST_VERSION,
"verifierVersion": VERIFIER_VERSION
"version": PACT_RUST_VERSION
}
}));
})));
}

#[test]
Expand All @@ -2101,7 +2094,7 @@ mod tests {
}))
]);
let payload = super::build_payload(result, "1".to_string(), None);
assert_eq!(payload, json!({
expect!(payload).to(be_equal_to(json!({
"providerApplicationVersion": "1",
"success": false,
"testResults": [
Expand All @@ -2117,10 +2110,9 @@ mod tests {
],
"verifiedBy": {
"implementation": "Pact-Rust",
"version": PACT_RUST_VERSION,
"verifierVersion": VERIFIER_VERSION
"version": PACT_RUST_VERSION
}
}));
})));
}

#[test]
Expand All @@ -2129,7 +2121,7 @@ mod tests {
(Some("1234abc".to_string()), Some(MismatchResult::Error("Bang".to_string(), Some("1234abc".to_string()))))
]);
let payload = super::build_payload(result, "1".to_string(), None);
assert_eq!(payload, json!({
expect!(payload).to(be_equal_to(json!({
"providerApplicationVersion": "1",
"success": false,
"testResults": [
Expand All @@ -2145,10 +2137,9 @@ mod tests {
],
"verifiedBy": {
"implementation": "Pact-Rust",
"version": PACT_RUST_VERSION,
"verifierVersion": VERIFIER_VERSION
"version": PACT_RUST_VERSION
}
}));
})));
}

#[test]
Expand All @@ -2166,7 +2157,7 @@ mod tests {
(Some("abc123".to_string()), None)
]);
let payload = super::build_payload(result, "1".to_string(), None);
assert_eq!(payload, json!({
expect!(payload).to(be_equal_to(json!({
"providerApplicationVersion": "1",
"success": false,
"testResults": [
Expand Down Expand Up @@ -2195,10 +2186,9 @@ mod tests {
],
"verifiedBy": {
"implementation": "Pact-Rust",
"version": PACT_RUST_VERSION,
"verifierVersion": VERIFIER_VERSION
"version": PACT_RUST_VERSION
}
}));
})));
}

#[test]
Expand Down
10 changes: 2 additions & 8 deletions rust/pact_verifier/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ use crate::{NullRequestFilterExecutor, PactSource, ProviderInfo, ProviderStateEx
use crate::callback_executors::HttpRequestProviderStateExecutor;
use crate::pact_broker::Link;
use crate::verification_result::VerificationInteractionResult;
use crate::VERIFIER_VERSION;

use super::{execute_state_change, filter_consumers, filter_interaction, FilterInfo};

Expand Down Expand Up @@ -294,8 +293,7 @@ async fn publish_successful_result_to_broker() {
],
"verifiedBy": json!({
"implementation": "Pact-Rust",
"version": PACT_RUST_VERSION,
"verifierVersion": VERIFIER_VERSION
"version": PACT_RUST_VERSION
})
}));
i.response.status(201);
Expand Down Expand Up @@ -999,11 +997,7 @@ async fn test_publish_results_from_url_source_with_provider_branch() {
"providerApplicationVersion": "1.2.3",
"success": true,
"testResults": [],
"verifiedBy": {
"implementation": "Pact-Rust",
"version": like!("0.4.5"),
"verifierVersion": like!("1.0.6")
}
"verifiedBy": { "implementation": "Pact-Rust", "version": like!("0.4.5") }
}));

i.response
Expand Down
18 changes: 3 additions & 15 deletions rust/pact_verifier/tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -442,11 +442,7 @@ async fn verify_multiple_pacts() {
"success": false
}
],
"verifiedBy": {
"implementation": "Pact-Rust",
"version": like!("1.0.0"),
"verifierVersion": like!("1.0.6")
}
"verifiedBy": { "implementation": "Pact-Rust", "version": like!("1.0.0") }
}));
i
})
Expand All @@ -472,11 +468,7 @@ async fn verify_multiple_pacts() {
"success": false
}
],
"verifiedBy":{
"implementation": "Pact-Rust",
"version": like!("1.0.0"),
"verifierVersion": like!("1.0.6")
}
"verifiedBy":{ "implementation": "Pact-Rust", "version": like!("1.0.0") }
}));
i
})
Expand Down Expand Up @@ -669,11 +661,7 @@ async fn verify_message_pact_with_two_interactions() {
"success": false
}
],
"verifiedBy": {
"implementation": "Pact-Rust",
"version": like!("1.0.0"),
"verifierVersion": like!("1.0.6")
}
"verifiedBy": { "implementation": "Pact-Rust", "version": like!("1.0.0") }
}));
i
})
Expand Down

0 comments on commit 167c445

Please sign in to comment.