forked from Fraunhofer-AISEC/ids-clearing-house-service
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3c34b8a
commit a144d17
Showing
8 changed files
with
812 additions
and
181 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
use axum::http::{Request, StatusCode}; | ||
use biscuit::jwa::SignatureAlgorithm::PS512; | ||
use biscuit::jwk::JWKSet; | ||
use testcontainers::runners::AsyncRunner; | ||
use clearing_house_app::model::claims::{get_fingerprint, ChClaims}; | ||
use clearing_house_app::model::ids::message::IdsMessage; | ||
use clearing_house_app::model::ids::request::ClearingHouseMessage; | ||
|
@@ -17,19 +18,25 @@ async fn log_message() { | |
const CLIENT_ID: &str = "69:F5:9D:B0:DD:A6:9D:30:5F:58:AA:2D:20:4D:B2:39:F0:54:FC:3B:keyid:4F:66:7D:BD:08:EE:C6:4A:D1:96:D8:7C:6C:A2:32:8A:EC:A6:AD:49"; | ||
|
||
// Start testcontainer: Postgres | ||
let docker = testcontainers::clients::Cli::default(); | ||
let postgres_instance = docker.run(testcontainers_modules::postgres::Postgres::default()); | ||
let postgres_instance = testcontainers_modules::postgres::Postgres::default() | ||
.start() | ||
.await | ||
.expect("Failed to start Postgres container"); | ||
let connection_string = format!( | ||
"postgres://postgres:[email protected]:{}/postgres", | ||
postgres_instance.get_host_port_ipv4(5432) | ||
"postgres://postgres:postgres@{}:{}/postgres", | ||
postgres_instance.get_host().await.expect("Failed to get host"), | ||
postgres_instance.get_host_port_ipv4(5432).await.expect("Failed to get port") | ||
); | ||
|
||
std::env::set_var("SERVICE_ID_LOG", "test"); | ||
std::env::set_var("SHARED_SECRET", "test"); | ||
std::env::set_var("CH_APP_LOG_LEVEL", "TRACE"); | ||
std::env::set_var("CH_APP_CLEAR_DB", "false"); | ||
std::env::set_var("CH_APP_STATIC_PROCESS_OWNER", "MDS_EDC_CONNECTOR"); | ||
std::env::set_var("CH_APP_DATABASE_URL", connection_string); | ||
#[allow(unsafe_code)] // Deprecated safe from rust edition 2024 | ||
unsafe { | ||
std::env::set_var("SERVICE_ID_LOG", "test"); | ||
std::env::set_var("SHARED_SECRET", "test"); | ||
std::env::set_var("CH_APP_LOG_LEVEL", "TRACE"); | ||
std::env::set_var("CH_APP_CLEAR_DB", "false"); | ||
std::env::set_var("CH_APP_STATIC_PROCESS_OWNER", "MDS_EDC_CONNECTOR"); | ||
std::env::set_var("CH_APP_DATABASE_URL", connection_string); | ||
} | ||
|
||
let app = clearing_house_app::app().await.unwrap(); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
use axum::http::{Request, StatusCode}; | ||
use biscuit::jwa::SignatureAlgorithm::PS512; | ||
use biscuit::jwk::JWKSet; | ||
use testcontainers::runners::AsyncRunner; | ||
use clearing_house_app::model::claims::{get_fingerprint, ChClaims}; | ||
use clearing_house_app::model::ids::message::IdsMessage; | ||
use clearing_house_app::model::ids::request::ClearingHouseMessage; | ||
|
@@ -15,18 +16,24 @@ use tower::ServiceExt; | |
#[tokio::test] | ||
async fn log_message() { | ||
// Start testcontainer: Postgres | ||
let docker = testcontainers::clients::Cli::default(); | ||
let postgres_instance = docker.run(testcontainers_modules::postgres::Postgres::default()); | ||
let postgres_instance = testcontainers_modules::postgres::Postgres::default() | ||
.start() | ||
.await | ||
.expect("Failed to start Postgres container"); | ||
let connection_string = format!( | ||
"postgres://postgres:[email protected]:{}/postgres", | ||
postgres_instance.get_host_port_ipv4(5432) | ||
"postgres://postgres:postgres@{}:{}/postgres", | ||
postgres_instance.get_host().await.expect("Failed to get host"), | ||
postgres_instance.get_host_port_ipv4(5432).await.expect("Failed to get port") | ||
); | ||
|
||
std::env::set_var("SERVICE_ID_LOG", "test"); | ||
std::env::set_var("SHARED_SECRET", "test"); | ||
std::env::set_var("CH_APP_LOG_LEVEL", "TRACE"); | ||
std::env::set_var("CH_APP_CLEAR_DB", "false"); | ||
std::env::set_var("CH_APP_DATABASE_URL", connection_string); | ||
#[allow(unsafe_code)] // Deprecated safe from rust edition 2024 | ||
unsafe { | ||
std::env::set_var("SERVICE_ID_LOG", "test"); | ||
std::env::set_var("SHARED_SECRET", "test"); | ||
std::env::set_var("CH_APP_LOG_LEVEL", "TRACE"); | ||
std::env::set_var("CH_APP_CLEAR_DB", "false"); | ||
std::env::set_var("CH_APP_DATABASE_URL", connection_string); | ||
} | ||
|
||
let app = clearing_house_app::app().await.unwrap(); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,27 @@ | ||
use axum::body::Body; | ||
use axum::http::{Request, StatusCode}; | ||
use biscuit::jwk::JWKSet; | ||
use testcontainers::runners::AsyncRunner; | ||
use tower::ServiceExt; | ||
|
||
#[tokio::test] | ||
async fn retrieve_public_key() { | ||
// Start testcontainer: Postgres | ||
let docker = testcontainers::clients::Cli::default(); | ||
let postgres_instance = docker.run(testcontainers_modules::postgres::Postgres::default()); | ||
let postgres_instance = testcontainers_modules::postgres::Postgres::default() | ||
.start() | ||
.await | ||
.expect("Failed to start Postgres container"); | ||
let connection_string = format!( | ||
"postgres://postgres:[email protected]:{}/postgres", | ||
postgres_instance.get_host_port_ipv4(5432) | ||
"postgres://postgres:postgres@{}:{}/postgres", | ||
postgres_instance.get_host().await.expect("Failed to get host"), | ||
postgres_instance.get_host_port_ipv4(5432).await.expect("Failed to get port") | ||
); | ||
|
||
std::env::set_var("SERVICE_ID_LOG", "test"); | ||
std::env::set_var("CH_APP_DATABASE_URL", connection_string); | ||
#[allow(unsafe_code)] // Deprecated safe from rust edition 2024 | ||
unsafe { | ||
std::env::set_var("SERVICE_ID_LOG", "test"); | ||
std::env::set_var("CH_APP_DATABASE_URL", connection_string); | ||
} | ||
|
||
let app = clearing_house_app::app().await.unwrap(); | ||
|
||
|