Skip to content

Commit 57b4273

Browse files
committed
chore: fix compatibility suite
1 parent 136f133 commit 57b4273

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

compatibility-suite/tests/shared_steps/consumer.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@ fn the_following_http_interactions_have_been_setup(world: &mut ConsumerWorld, st
6464

6565
#[when(expr = "the mock server is started with interaction {int}")]
6666
async fn the_mock_server_is_started_with_interaction(world: &mut ConsumerWorld, interaction: usize) -> anyhow::Result<()> {
67+
if rustls::crypto::CryptoProvider::get_default().is_none() {
68+
if let Err(_) = rustls::crypto::ring::default_provider().install_default() {
69+
warn!("failed to installed the default crypto provider");
70+
}
71+
}
72+
6773
let pact = RequestResponsePact {
6874
consumer: Consumer { name: "v1-compatibility-suite-c".to_string() },
6975
provider: Provider { name: "p".to_string() },
@@ -100,6 +106,12 @@ async fn the_mock_server_is_started_with_interaction_but_with_the_following_chan
100106
step: &Step,
101107
interaction: usize
102108
) -> anyhow::Result<()> {
109+
if rustls::crypto::CryptoProvider::get_default().is_none() {
110+
if let Err(_) = rustls::crypto::ring::default_provider().install_default() {
111+
warn!("failed to installed the default crypto provider");
112+
}
113+
}
114+
103115
let mut request_response_interaction = world.interactions
104116
.get(interaction - 1).unwrap().clone();
105117

@@ -162,6 +174,12 @@ async fn the_mock_server_is_started_with_interaction_but_with_the_following_chan
162174

163175
#[when(expr = "the mock server is started with interactions {string}")]
164176
async fn the_mock_server_is_started_with_interactions(world: &mut ConsumerWorld, ids: String) -> anyhow::Result<()> {
177+
if rustls::crypto::CryptoProvider::get_default().is_none() {
178+
if let Err(_) = rustls::crypto::ring::default_provider().install_default() {
179+
warn!("failed to installed the default crypto provider");
180+
}
181+
}
182+
165183
let interactions = ids.split(",")
166184
.map(|id| id.trim().parse::<usize>().unwrap())
167185
.map(|index| world.interactions.get(index - 1).unwrap().clone())

0 commit comments

Comments
 (0)