I'm trying the async example of testcontainers:
#[test]
async fn testcontainers() {
let container = GenericImage::new("redis", "7.2.4")
// .with_exposed_port(6379.tcp())
.with_wait_for(WaitFor::message_on_stdout("Ready to accept connections"))
.start()
.await
.expect("Redis started");
}
Here is the output:
running 1 test
test testcontainers ... FAILED
failures:
---- testcontainers stdout ----
thread 'testcontainers' panicked at tests/integration_test.rs:33:10:
Redis started: Client(CreateContainer(HyperLegacyError { err: hyper_util::client::legacy::Error(Connect, Os { code: 13, kind: PermissionDenied, message: "Permission denied" }) }))
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
failures:
testcontainers
But I get PermissionDenied error, and I suspect it's because my Docker instance requires sudo. How do I run the test in sudo? Or is there a better way to fix this issue?