Skip to content

Commit eef3495

Browse files
Refactor testcontainers integration (#58)
* Refactor testcontainers integration, available in module `restate-sdk-testcontainers`. * Add /health endpoint
1 parent 8c77163 commit eef3495

File tree

8 files changed

+312
-338
lines changed

8 files changed

+312
-338
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,4 @@ syn = "2.0"
6060
typify = { version = "0.1.0" }
6161

6262
[workspace]
63-
members = ["macros", "test-services", "test-env"]
63+
members = ["macros", "test-services", "testcontainers"]

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ Just configure it as usual through [`tracing_subscriber`](https://docs.rs/tracin
6666
### Testing
6767

6868
The SDK uses [Testcontainers](https://rust.testcontainers.org/) to support integration testing using a Docker-deployed restate server.
69-
The `restate-sdk-test-env` crate provides a framework for initializing the test environment, and an integration test example in `test-env/tests/test_container.rs`.
69+
The `restate-sdk-testcontainers` crate provides a framework for initializing the test environment, and an integration test example in `testcontainers/tests/test_container.rs`.
7070

7171
```rust
7272
#[tokio::test]

justfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ print-target:
6464
@echo {{ _resolved_target }}
6565

6666
test: (_target-installed target)
67-
cargo nextest run {{ _target-option }} --all-features
67+
cargo nextest run {{ _target-option }} --all-features --workspace
6868

6969
doctest:
7070
cargo test --doc

src/endpoint/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,14 @@ impl Endpoint {
284284

285285
let parts: Vec<&str> = path.split('/').collect();
286286

287+
if parts.last() == Some(&"health") {
288+
return Ok(Response::ReplyNow {
289+
status_code: 200,
290+
headers: vec![],
291+
body: Bytes::new(),
292+
});
293+
}
294+
287295
if parts.last() == Some(&"discover") {
288296
let accept_header = headers
289297
.extract("accept")

test-env/src/lib.rs

Lines changed: 0 additions & 321 deletions
This file was deleted.
Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
[package]
2-
name = "restate-sdk-test-env"
2+
name = "restate-sdk-testcontainers"
33
version = "0.4.0"
44
edition = "2021"
5-
description = "Test Utilities for Restate SDK for Rust"
5+
description = "Restate SDK Testcontainers utilities"
66
license = "MIT"
77
repository = "https://github.com/restatedev/sdk-rust"
88
rust-version = "1.76.0"
99

1010

1111
[dependencies]
1212
anyhow = "1.0.95"
13-
nu-ansi-term = "0.50.1"
13+
futures = "0.3.31"
1414
reqwest = { version= "0.12.12", features = ["json"] }
1515
restate-sdk = { version = "0.4.0", path = "../" }
1616
serde = "1.0.217"
17-
serde_json = "1.0.138"
18-
testcontainers = "0.23.1"
17+
testcontainers = { version = "0.23.3", features = ["http_wait"] }
1918
tokio = "1.43.0"
2019
tracing = "0.1.41"
2120
tracing-subscriber = "0.3.19"

0 commit comments

Comments
 (0)