Skip to content

Commit 7438f07

Browse files
committed
fixup! Update opentelemetry to 0.32
1 parent b3273c7 commit 7438f07

3 files changed

Lines changed: 24 additions & 6 deletions

File tree

payjoin-cli/tests/e2e.rs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,9 @@ mod e2e {
103103
#[cfg(feature = "v1")]
104104
#[tokio::test(flavor = "multi_thread", worker_threads = 4)]
105105
async fn send_receive_payjoin_v1() -> Result<(), BoxError> {
106-
use payjoin_test_utils::local_cert_key;
106+
use payjoin_test_utils::{init_crypto_provider, local_cert_key};
107107

108+
init_crypto_provider();
108109
let (bitcoind, _sender, _receiver) = init_bitcoind_sender_receiver(None, None)?;
109110
let temp_dir = tempdir()?;
110111
let receiver_db_path = temp_dir.path().join("receiver_db");
@@ -235,12 +236,13 @@ mod e2e {
235236
#[cfg(feature = "v2")]
236237
#[tokio::test(flavor = "multi_thread", worker_threads = 4)]
237238
async fn send_receive_payjoin_v2() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
238-
use payjoin_test_utils::{init_tracing, TestServices};
239+
use payjoin_test_utils::{init_crypto_provider, init_tracing, TestServices};
239240
use tempfile::TempDir;
240241

241242
type Result<T> = std::result::Result<T, BoxError>;
242243

243244
init_tracing();
245+
init_crypto_provider();
244246
let mut services = TestServices::initialize_with_relays(3).await?;
245247
let temp_dir = tempdir()?;
246248

@@ -522,12 +524,15 @@ mod e2e {
522524
#[tokio::test(flavor = "multi_thread", worker_threads = 4)]
523525
async fn send_receive_payjoin_v2_to_v1() -> Result<(), Box<dyn std::error::Error + Send + Sync>>
524526
{
525-
use payjoin_test_utils::{init_tracing, local_cert_key, TestServices};
527+
use payjoin_test_utils::{
528+
init_crypto_provider, init_tracing, local_cert_key, TestServices,
529+
};
526530
use tempfile::TempDir;
527531

528532
type Result<T> = std::result::Result<T, BoxError>;
529533

530534
init_tracing();
535+
init_crypto_provider();
531536
let services = TestServices::initialize_with_relays(3).await?;
532537
let temp_dir = tempdir()?;
533538

@@ -679,12 +684,13 @@ mod e2e {
679684
#[cfg(feature = "v2")]
680685
#[tokio::test(flavor = "multi_thread", worker_threads = 4)]
681686
async fn sender_cancel_v2() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
682-
use payjoin_test_utils::{init_tracing, TestServices};
687+
use payjoin_test_utils::{init_crypto_provider, init_tracing, TestServices};
683688
use tempfile::TempDir;
684689

685690
type Result<T> = std::result::Result<T, BoxError>;
686691

687692
init_tracing();
693+
init_crypto_provider();
688694
let mut services = TestServices::initialize_with_relays(3).await?;
689695
let temp_dir = tempdir()?;
690696

@@ -855,12 +861,13 @@ mod e2e {
855861
#[cfg(feature = "v2")]
856862
#[tokio::test(flavor = "multi_thread", worker_threads = 4)]
857863
async fn receiver_cancel_v2() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
858-
use payjoin_test_utils::{init_tracing, TestServices};
864+
use payjoin_test_utils::{init_crypto_provider, init_tracing, TestServices};
859865
use tempfile::TempDir;
860866

861867
type Result<T> = std::result::Result<T, BoxError>;
862868

863869
init_tracing();
870+
init_crypto_provider();
864871
let mut services = TestServices::initialize_with_relays(3).await?;
865872
let temp_dir = tempdir()?;
866873

payjoin-test-utils/src/lib.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ pub type BoxError = Box<dyn std::error::Error + 'static>;
1717
pub type BoxSendSyncError = Box<dyn std::error::Error + Send + Sync>;
1818

1919
static INIT_TRACING: OnceCell<()> = OnceCell::new();
20+
static INIT_CRYPTO_PROVIDER: OnceCell<()> = OnceCell::new();
2021

2122
pub fn init_tracing() {
2223
INIT_TRACING.get_or_init(|| {
@@ -30,6 +31,14 @@ pub fn init_tracing() {
3031
});
3132
}
3233

34+
pub fn init_crypto_provider() {
35+
INIT_CRYPTO_PROVIDER.get_or_init(|| {
36+
rustls::crypto::ring::default_provider()
37+
.install_default()
38+
.expect("Failed to install default crypto provider");
39+
});
40+
}
41+
3342
pub fn init_bitcoind() -> Result<corepc_node::Node, BoxError> {
3443
let bitcoind_exe = corepc_node::exe_path()?;
3544
let mut conf = corepc_node::Conf::default();

payjoin/tests/integration.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,8 @@ mod integration {
213213
use payjoin::send::ResponseError;
214214
use payjoin::{OhttpKeys, PjUri, UriExt};
215215
use payjoin_test_utils::{
216-
BoxSendSyncError, InMemoryPersister, SessionPersister, TestServices,
216+
init_crypto_provider, BoxSendSyncError, InMemoryPersister, SessionPersister,
217+
TestServices,
217218
};
218219
#[cfg(feature = "v1")]
219220
use reqwest::Client;
@@ -233,6 +234,7 @@ mod integration {
233234

234235
#[tokio::test]
235236
async fn test_bad_ohttp_keys() -> Result<(), BoxSendSyncError> {
237+
init_crypto_provider();
236238
let bytes = CheckedHrpstring::new::<NoChecksum>(
237239
"OH1QYPM5JXYNS754Y4R45QWE336QFX6ZR8DQGVQCULVZTV20TFVEYDMFQC",
238240
)?

0 commit comments

Comments
 (0)