Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Docker Send and Sync #384

Merged
merged 4 commits into from
Jul 19, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion testcontainers/src/core/container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ where
///
/// This trait is pub(crate) because it should not be used directly by users but only represents an internal abstraction that allows containers to be generic over the client they have been started with.
/// All functionality of this trait is available on [`Container`]s directly.
pub(crate) trait Docker {
pub(crate) trait Docker: Sync + Send {
fn stdout_logs(&self, id: &str) -> LogStream;
fn stderr_logs(&self, id: &str) -> LogStream;
fn ports(&self, id: &str) -> Ports;
Expand All @@ -248,3 +248,17 @@ pub(crate) trait Docker {
fn exec(&self, id: &str, cmd: String);
fn block_until_ready(&self, id: &str, ready_conditions: Vec<WaitFor>);
}

#[cfg(test)]
mod test {

use super::Container;
use crate::images::hello_world::HelloWorld;

#[test]
fn container_should_be_send_and_sync() {
assert_send_and_sync::<Container<'_, HelloWorld>>();
}

fn assert_send_and_sync<T: Send + Sync>() {}
}