From 167c44506cbdf9e5bd7f7cdadcdd390be040cd73 Mon Sep 17 00:00:00 2001 From: Ronald Holshausen Date: Mon, 19 Feb 2024 05:59:22 +1100 Subject: [PATCH] Revert "feat(verifier): Add the verifier version to the published results #307" This reverts commit 6962fceee119ac40c39c2a88115acf058125aeab. --- rust/pact_verifier/src/lib.rs | 2 - rust/pact_verifier/src/pact_broker.rs | 54 +++++++++++---------------- rust/pact_verifier/src/tests.rs | 10 +---- rust/pact_verifier/tests/tests.rs | 18 ++------- 4 files changed, 27 insertions(+), 57 deletions(-) diff --git a/rust/pact_verifier/src/lib.rs b/rust/pact_verifier/src/lib.rs index 4094815c1..8b91bb275 100644 --- a/rust/pact_verifier/src/lib.rs +++ b/rust/pact_verifier/src/lib.rs @@ -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 { diff --git a/rust/pact_verifier/src/pact_broker.rs b/rust/pact_verifier/src/pact_broker.rs index 027cc0d0d..cc2e80518 100644 --- a/rust/pact_verifier/src/pact_broker.rs +++ b/rust/pact_verifier/src/pact_broker.rs @@ -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, field: &str) -> bool { @@ -821,8 +820,7 @@ fn build_payload(result: TestResult, version: String, build_url: Option) "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(); @@ -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::*; @@ -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", @@ -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] @@ -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": [ @@ -2117,10 +2110,9 @@ mod tests { ], "verifiedBy": { "implementation": "Pact-Rust", - "version": PACT_RUST_VERSION, - "verifierVersion": VERIFIER_VERSION + "version": PACT_RUST_VERSION } - })); + }))); } #[test] @@ -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": [ @@ -2145,10 +2137,9 @@ mod tests { ], "verifiedBy": { "implementation": "Pact-Rust", - "version": PACT_RUST_VERSION, - "verifierVersion": VERIFIER_VERSION + "version": PACT_RUST_VERSION } - })); + }))); } #[test] @@ -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": [ @@ -2195,10 +2186,9 @@ mod tests { ], "verifiedBy": { "implementation": "Pact-Rust", - "version": PACT_RUST_VERSION, - "verifierVersion": VERIFIER_VERSION + "version": PACT_RUST_VERSION } - })); + }))); } #[test] diff --git a/rust/pact_verifier/src/tests.rs b/rust/pact_verifier/src/tests.rs index d21e35286..d510b291d 100644 --- a/rust/pact_verifier/src/tests.rs +++ b/rust/pact_verifier/src/tests.rs @@ -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}; @@ -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); @@ -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 diff --git a/rust/pact_verifier/tests/tests.rs b/rust/pact_verifier/tests/tests.rs index 08bf2a783..8265e2d86 100644 --- a/rust/pact_verifier/tests/tests.rs +++ b/rust/pact_verifier/tests/tests.rs @@ -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 }) @@ -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 }) @@ -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 })