Giter VIP home page Giter VIP logo

Comments (7)

thomaseizinger avatar thomaseizinger commented on May 30, 2024

This could be related to this issue maybe? #106

We are shutting down containers in the Drop implementation which to my knowledge should be called properly every time 🤔

from testcontainers-rs.

sazzer avatar sazzer commented on May 30, 2024

from testcontainers-rs.

thomaseizinger avatar thomaseizinger commented on May 30, 2024

We just merged a PR that might fix this issue (#200), do you mind giving the latest dev branch a go and see if your issue is fixed with that?

from testcontainers-rs.

sazzer avatar sazzer commented on May 30, 2024

Things work great from Cargo as normal, but in VSCode the tests now don't work at all. Instead I get this:

running 1 test
thread 'test_migrate_database' panicked at 'Failed to execute docker command: Os { code: 2, kind: NotFound, message: "No such file or directory" }', /Users/coxg/.cargo/git/checkouts/testcontainers-rs-a2ab8cd26ca6a326/8f0b5d5/src/clients/cli.rs:115:21
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/libunwind.rs:86
   1: backtrace::backtrace::trace_unsynchronized
             at /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:78
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:59
   4: core::fmt::write
             at src/libstd/../stdarch/crates/std_detect/src/detect/os/x86.rs:253
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1537
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:62
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:49
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:198
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:218
  10: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:486
  11: rust_begin_unwind
             at src/libstd/panicking.rs:388
  12: core::panicking::panic_fmt
             at src/libcore/panicking.rs:101
  13: core::option::expect_none_failed
             at src/libcore/option.rs:1272
  14: core::result::Result<T,E>::expect
             at /Users/coxg/.cargo/registry/src/github.com-1ecc6299db9ec823/serde_json-1.0.57/src/de.rs:1701
  15: <testcontainers::clients::cli::Cli as testcontainers::core::docker::Docker>::run
             at /Users/coxg/.cargo/git/checkouts/testcontainers-rs-a2ab8cd26ca6a326/8f0b5d5/src/clients/cli.rs:115
  16: mire_testdatabase::TestDatabase::new
             at crates/testdatabase/src/lib.rs:36
  17: test::test_migrate_database::{{closure}}
             at crates/database/tests/test.rs:6
  18: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /Users/coxg/.rustup/toolchains/1.45.2-x86_64-apple-darwin/lib/rustlib/src/rust/src/libcore/future/mod.rs:73
  19: <tokio::task::local::RunUntil<T> as core::future::future::Future>::poll::{{closure}}::{{closure}}
             at /Users/coxg/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/task/local.rs:528
  20: tokio::coop::with_budget::{{closure}}
             at /Users/coxg/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/coop.rs:127
  21: std::thread::local::LocalKey<T>::try_with
             at /Users/coxg/.rustup/toolchains/1.45.2-x86_64-apple-darwin/lib/rustlib/src/rust/src/libstd/thread/local.rs:263
  22: std::thread::local::LocalKey<T>::with
             at /Users/coxg/.rustup/toolchains/1.45.2-x86_64-apple-darwin/lib/rustlib/src/rust/src/libstd/thread/local.rs:239
  23: tokio::coop::with_budget
             at /Users/coxg/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/coop.rs:120
  24: tokio::coop::budget
             at /Users/coxg/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/coop.rs:96
  25: <tokio::task::local::RunUntil<T> as core::future::future::Future>::poll::{{closure}}
             at /Users/coxg/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/task/local.rs:528
  26: tokio::macros::scoped_tls::ScopedKey<T>::set
             at /Users/coxg/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/macros/scoped_tls.rs:63
  27: tokio::task::local::LocalSet::with
             at /Users/coxg/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/task/local.rs:442
  28: <tokio::task::local::RunUntil<T> as core::future::future::Future>::poll
             at /Users/coxg/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/task/local.rs:518
  29: tokio::task::local::LocalSet::run_until::{{closure}}
             at /Users/coxg/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/task/local.rs:392
  30: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at /Users/coxg/.rustup/toolchains/1.45.2-x86_64-apple-darwin/lib/rustlib/src/rust/src/libcore/future/mod.rs:73
  31: tokio::runtime::basic_scheduler::BasicScheduler<P>::block_on::{{closure}}::{{closure}}
             at /Users/coxg/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/basic_scheduler.rs:131
  32: tokio::coop::with_budget::{{closure}}
             at /Users/coxg/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/coop.rs:127
  33: std::thread::local::LocalKey<T>::try_with
             at /Users/coxg/.rustup/toolchains/1.45.2-x86_64-apple-darwin/lib/rustlib/src/rust/src/libstd/thread/local.rs:263
  34: std::thread::local::LocalKey<T>::with
             at /Users/coxg/.rustup/toolchains/1.45.2-x86_64-apple-darwin/lib/rustlib/src/rust/src/libstd/thread/local.rs:239
  35: tokio::coop::with_budget
             at /Users/coxg/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/coop.rs:120
  36: tokio::coop::budget
             at /Users/coxg/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/coop.rs:96
  37: tokio::runtime::basic_scheduler::BasicScheduler<P>::block_on::{{closure}}
             at /Users/coxg/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/basic_scheduler.rs:131
  38: tokio::runtime::basic_scheduler::enter::{{closure}}
             at /Users/coxg/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/basic_scheduler.rs:213
  39: tokio::macros::scoped_tls::ScopedKey<T>::set
             at /Users/coxg/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/macros/scoped_tls.rs:63
  40: tokio::runtime::basic_scheduler::enter
             at /Users/coxg/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/basic_scheduler.rs:213
  41: tokio::runtime::basic_scheduler::BasicScheduler<P>::block_on
             at /Users/coxg/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/basic_scheduler.rs:123
  42: tokio::runtime::Runtime::block_on::{{closure}}
             at /Users/coxg/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/mod.rs:444
  43: tokio::runtime::context::enter
             at /Users/coxg/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/context.rs:72
  44: tokio::runtime::handle::Handle::enter
             at /Users/coxg/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/handle.rs:76
  45: tokio::runtime::Runtime::block_on
             at /Users/coxg/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/runtime/mod.rs:441
  46: tokio::task::local::LocalSet::block_on
             at /Users/coxg/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.2.22/src/task/local.rs:353
  47: actix_rt::runtime::Runtime::block_on
             at /Users/coxg/.cargo/registry/src/github.com-1ecc6299db9ec823/actix-rt-1.1.1/src/runtime.rs:89
  48: actix_rt::builder::SystemRunner::block_on
             at /Users/coxg/.cargo/registry/src/github.com-1ecc6299db9ec823/actix-rt-1.1.1/src/builder.rs:187
  49: test::test_migrate_database
             at crates/database/tests/test.rs:4
  50: test::test_migrate_database::{{closure}}
             at crates/database/tests/test.rs:4
  51: core::ops::function::FnOnce::call_once
             at /Users/coxg/.rustup/toolchains/1.45.2-x86_64-apple-darwin/lib/rustlib/src/rust/src/libcore/ops/function.rs:232
  52: <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once
             at /rustc/d3fb005a39e62501b8b0b356166e515ae24e2e54/src/liballoc/boxed.rs:1076
  53: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /rustc/d3fb005a39e62501b8b0b356166e515ae24e2e54/src/libstd/panic.rs:318
  54: std::panicking::try::do_call
             at /rustc/d3fb005a39e62501b8b0b356166e515ae24e2e54/src/libstd/panicking.rs:297
  55: std::panicking::try
             at /rustc/d3fb005a39e62501b8b0b356166e515ae24e2e54/src/libstd/panicking.rs:274
  56: std::panic::catch_unwind
             at /rustc/d3fb005a39e62501b8b0b356166e515ae24e2e54/src/libstd/panic.rs:394
  57: test::run_test_in_process
             at src/libtest/lib.rs:541
  58: test::run_test::run_test_inner::{{closure}}
             at src/libtest/lib.rs:450
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Panic in Arbiter thread.
test test_migrate_database ... FAILED

I'm not sure yet why that's happening. The implication is that docker isn't on the path, but it really should be and it does work.

I think this is actually a problem with rust-analyzer or with my system though, since I've just rolled back to testcontainers 0.9.1 and it's still doing the same thing :\

from testcontainers-rs.

sazzer avatar sazzer commented on May 30, 2024

Yes, it does work :)

The problem above was that the path being seen by the tests is /Users/sazzer/.cargo/bin:/usr/bin:/bin:/usr/sbin:/sbin, and the com.docker.cli executable is in /usr/local/bin.

I've since symlinked that into the path, and now:

  • 0.9.1 - Container is not stopped
  • 0.10.0 - Container is not stopped
  • dev branch - Container is stopped :)

Cheers

from testcontainers-rs.

sazzer avatar sazzer commented on May 30, 2024

I've also tested - the container stops both on test pass and test failure.

Cheers

from testcontainers-rs.

thomaseizinger avatar thomaseizinger commented on May 30, 2024

Awesome, thanks for the thorough testing!
We can close this then and cut a release soon :)

from testcontainers-rs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.