Skip to content

Commit

Permalink
Merge #384
Browse files Browse the repository at this point in the history
384: Make Docker Send and Sync r=thomaseizinger a=ufoscout

This fixes #354 allowing singleton instances of a container.
Fixes  #381 also

Co-authored-by: Francesco_Cina <[email protected]>
Co-authored-by: Francesco Cinà <[email protected]>
  • Loading branch information
3 people authored Jul 19, 2022
2 parents 6f4ab41 + 0594504 commit 9271733
Showing 1 changed file with 15 additions and 1 deletion.
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>() {}
}

0 comments on commit 9271733

Please sign in to comment.