Skip to content

Commit

Permalink
Add assert that port 8081 is not in use
Browse files Browse the repository at this point in the history
  • Loading branch information
sgreenbury committed Jan 13, 2025
1 parent 642d970 commit 63b6933
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ log = "0.4"
mockall = "0.11.4"
mongodb = "2.3.1"
petgraph = "0.6"
port_check = "0.2.1"
ps_sig = { git = "https://github.com/alan-turing-institute/RSS.git", rev = "ec9386e125d87c5f54898b34fbe0883b3b36ffd4" }
qrcode = "0.12.0"
rand = "0.8"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ cargo build
```
Install the Trustchain CLI with:
```shell
cargo install --path trustchain-cli
cargo install --path crates/trustchain-cli
```

## Usage Guide
Expand Down
1 change: 1 addition & 0 deletions crates/trustchain-http/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,5 @@ trustchain-ion = { path = "../trustchain-ion" }
axum-test-helper = { workspace = true }
itertools = { workspace = true }
mockall = { workspace = true }
port_check = { workspace = true }
tempfile = { workspace = true }
7 changes: 6 additions & 1 deletion crates/trustchain-http/tests/attestation.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/// Integration test for attestation challenge-response process.
//! Integration test for attestation challenge-response process.
use port_check::is_port_reachable;
use tokio::runtime::Runtime;
use trustchain_core::verifier::Verifier;
use trustchain_http::attestation_encryption_utils::{josekit_to_ssi_jwk, ssi_to_josekit_jwk};
Expand Down Expand Up @@ -27,6 +28,10 @@ pub trait AttestationUtils {

fn init_http() {
init();
assert!(
!is_port_reachable("127.0.0.1:8081"),
"Port 8081 is required for Challenge-Response integration test but 8081 is already in use."
);
let http_config = HTTPConfig {
host: "127.0.0.1".parse().unwrap(),
port: 8081,
Expand Down

0 comments on commit 63b6933

Please sign in to comment.