rust testcontainer framework#41
Merged
slinkydeveloper merged 12 commits intorestatedev:mainfrom Feb 20, 2025
Merged
Conversation
Contributor
|
This is awesome, i'll give a look in the next days! |
Contributor
slinkydeveloper
left a comment
There was a problem hiding this comment.
just left few initial comments, thanks for the contribution!
Contributor
Author
|
@slinkydeveloper thanks for the feedback! Just pushed an update that captures the above. Here's the new test implementation: #[tokio::test]
async fn test_container_image() {
let mut test_container = TestContainer::new("docker.io/restatedev/restate", "latest").await.unwrap();
let endpoint = Endpoint::builder()
.bind(MyServiceImpl.serve())
.build();
test_container.serve_endpoint(endpoint).await;
// optionally insert a delays via tokio sleep
TestContainer::delay(1000).await;
// optionally call invoke on service handlers
use restate_sdk::service::Discoverable;
let my_service:Service = ServeMyService::<MyServiceImpl>::discover();
let invoke_response = test_container.invoke(my_service, "my_handler").await;
assert!(invoke_response.is_ok());
println!("invoke response:");
println!("{}", invoke_response.unwrap().text().await.unwrap());
} |
Contributor
slinkydeveloper
left a comment
There was a problem hiding this comment.
Hi! Thanks again for the contribution, I had some time to take a look, it's getting there, I think the API needs another pass
Contributor
slinkydeveloper
left a comment
There was a problem hiding this comment.
This is awesome. Run just check locally to fix linting/formatting issues and then we should be good to go!
Contributor
Author
|
thanks again for the recs and sorry for not running lint/fmt! should be good to go now |
slinkydeveloper
approved these changes
Feb 19, 2025
Contributor
slinkydeveloper
left a comment
There was a problem hiding this comment.
One minor nit, and I merge
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Here's my initial shot at a testcontainers implementation for the Rust SDK.
I've got the core functionality working, but wanted to share while in progress to see if adding a new "restate-test-utils" crate to the SDK is ok. Also wanted to solicit feedback on ways to extend the test implementation (e.g. mirroring Temporal's approach), per discussions on Discord.
Here's the current test implementation for a service as defined in
tests/test_container.rs