Odd behavior with should_execute_without_wait test with arm64
alanivey opened this issue · 3 comments
I am building wait
for arm64 in a Docker container because I do not have a Rust build environment on my regular environment (this is using the recent Docker qemu feature, but the same thing happens if I run the same on a Raspberry Pi 4). I am not familiar with Rust, but I wanted to show that running cargo test
fails on the should_execute_without_wait test:
$ docker run --rm -i --platform linux/arm64 --workdir /work --env WAIT_VERSION=2.9.0 rust:1.52.1-buster bash -s <<'EOF'
set -euo pipefail
set -x
git clone https://github.com/ufoscout/docker-compose-wait.git source
cd source
git checkout "${WAIT_VERSION}"
R_TARGET="$( rustup target list --installed | grep -- '-gnu' | tail -1 | awk '{print $1}'| sed 's/gnu/musl/' )"
rustup target add "$R_TARGET"
cargo test
cargo build --release --target="$R_TARGET"
strip ./target/"$R_TARGET"/release/wait
target/"$R_TARGET"/release/wait
EOF
Output:
+ git clone https://github.com/ufoscout/docker-compose-wait.git source
Cloning into 'source'...
+ cd source
+ git checkout 2.9.0
Note: checking out '2.9.0'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b <new-branch-name>
HEAD is now at 5098f22 Merge pull request #52 from ufoscout/feature/wait_for_path
++ rustup target list --installed
++ grep -- -gnu
++ tail -1
++ awk '{print $1}'
++ sed s/gnu/musl/
+ R_TARGET=aarch64-unknown-linux-musl
+ rustup target add aarch64-unknown-linux-musl
info: downloading component 'rust-std' for 'aarch64-unknown-linux-musl'
info: installing component 'rust-std' for 'aarch64-unknown-linux-musl'
info: using up to 500.0 MiB of RAM to unpack components
+ cargo test
Updating crates.io index
Downloading crates ...
Downloaded lazy_static v1.4.0
Downloaded rand_core v0.6.2
Downloaded rand v0.8.3
Downloaded env_logger v0.8.3
Downloaded cfg-if v1.0.0
Downloaded atomic-counter v1.0.1
Downloaded log v0.4.14
Downloaded rand_chacha v0.3.0
Downloaded ppv-lite86 v0.2.10
Downloaded port_check v0.1.5
Downloaded libc v0.2.94
Downloaded getrandom v0.2.2
Compiling cfg-if v1.0.0
Compiling libc v0.2.94
Compiling getrandom v0.2.2
Compiling log v0.4.14
Compiling port_check v0.1.5
Compiling ppv-lite86 v0.2.10
Compiling lazy_static v1.4.0
Compiling atomic-counter v1.0.1
Compiling env_logger v0.8.3
Compiling wait v2.9.0 (/work/source)
Compiling rand_core v0.6.2
Compiling rand_chacha v0.3.0
Compiling rand v0.8.3
Finished test [unoptimized + debuginfo] target(s) in 2m 19s
Running unittests (target/debug/deps/wait-9844c520be7e6e56)
running 11 tests
test sleeper::test::should_not_wait ... ok
test test::should_return_int_value ... ok
test test::should_return_zero_when_empty_value ... ok
test test::should_return_zero_when_invalid_value ... ok
test test::should_return_zero_when_negative_value ... ok
test env_reader::test::should_return_an_env_variable ... ok
test test::should_get_config_values_from_env ... ok
test test::should_get_default_config_values ... ok
test test::config_should_use_default_values ... ok
test env_reader::test::should_return_the_default_value_if_env_variable_not_present ... ok
test sleeper::test::should_wait_for_a_second ... ok
test result: ok. 11 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 3.07s
Running unittests (target/debug/deps/wait-060dd7f6789cdbf7)
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Running tests/integration_test.rs (target/debug/deps/integration_test-330808617b3ccde1)
running 16 tests
test should_exit_on_path_timeout ... ok
test should_execute_without_wait ... FAILED
test should_exit_on_host_timeout ... ok
test should_wait_before_and_after ... ok
test should_wait_for_10_seconds_after ... ok
test should_wait_for_5_seconds_before ... ok
test should_identify_the_open_port ... ok
test should_fail_if_not_all_hosts_are_available ... ok
test should_fail_if_hosts_are_available_but_paths_are_not ... ok
test should_wait_for_multiple_hosts ... ok
test should_fail_if_paths_are_available_but_hosts_are_not ... ok
test should_wait_for_multiple_paths ... ok
test should_fail_if_not_all_paths_are_available ... ok
test should_wait_for_multiple_hosts_and_paths ... ok
test should_sleep_the_specified_time_between_path_checks ... ok
test should_sleep_the_specified_time_between_host_checks ... ok
failures:
---- should_execute_without_wait stdout ----
Millis elapsed 35
thread 'should_execute_without_wait' panicked at 'assertion failed: millis_elapsed(start) <= 5', tests/integration_test.rs:56:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
failures:
should_execute_without_wait
test result: FAILED. 15 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 2.21s
error: test failed, to rerun pass '--test integration_test'
I ran it again with RUST_BACKTRACE=full
in the environment, which you can see by expanding below:
Full output of `cargo test`:
Updating crates.io index
Downloading crates ...
Downloaded env_logger v0.8.3
Downloaded rand_core v0.6.2
Downloaded rand v0.8.3
Downloaded ppv-lite86 v0.2.10
Downloaded libc v0.2.94
Downloaded cfg-if v1.0.0
Downloaded atomic-counter v1.0.1
Downloaded log v0.4.14
Downloaded rand_chacha v0.3.0
Downloaded port_check v0.1.5
Downloaded lazy_static v1.4.0
Downloaded getrandom v0.2.2
Compiling cfg-if v1.0.0
Compiling libc v0.2.94
Compiling getrandom v0.2.2
Compiling log v0.4.14
Compiling port_check v0.1.5
Compiling ppv-lite86 v0.2.10
Compiling lazy_static v1.4.0
Compiling atomic-counter v1.0.1
Compiling env_logger v0.8.3
Compiling wait v2.9.0 (/work/source)
Compiling rand_core v0.6.2
Compiling rand_chacha v0.3.0
Compiling rand v0.8.3
Finished test [unoptimized + debuginfo] target(s) in 2m 19s
Running unittests (target/debug/deps/wait-9844c520be7e6e56)
running 11 tests
test sleeper::test::should_not_wait ... ok
test test::should_return_int_value ... ok
test env_reader::test::should_return_an_env_variable ... ok
test test::should_return_zero_when_invalid_value ... ok
test test::should_return_zero_when_empty_value ... ok
test test::should_return_zero_when_negative_value ... ok
test test::config_should_use_default_values ... ok
test test::should_get_default_config_values ... ok
test test::should_get_config_values_from_env ... ok
test env_reader::test::should_return_the_default_value_if_env_variable_not_present ... ok
test sleeper::test::should_wait_for_a_second ... ok
test result: ok. 11 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 3.06s
Running unittests (target/debug/deps/wait-060dd7f6789cdbf7)
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Running tests/integration_test.rs (target/debug/deps/integration_test-330808617b3ccde1)
running 16 tests
test should_exit_on_path_timeout ... ok
test should_exit_on_host_timeout ... ok
test should_execute_without_wait ... FAILED
test should_wait_before_and_after ... ok
test should_wait_for_10_seconds_after ... ok
test should_wait_for_5_seconds_before ... ok
test should_identify_the_open_port ... ok
test should_fail_if_not_all_hosts_are_available ... ok
test should_fail_if_hosts_are_available_but_paths_are_not ... ok
test should_fail_if_paths_are_available_but_hosts_are_not ... ok
test should_wait_for_multiple_paths ... ok
test should_wait_for_multiple_hosts ... ok
test should_fail_if_not_all_paths_are_available ... ok
test should_wait_for_multiple_hosts_and_paths ... ok
test should_sleep_the_specified_time_between_host_checks ... ok
test should_sleep_the_specified_time_between_path_checks ... ok
failures:
---- should_execute_without_wait stdout ----
Millis elapsed 43
thread 'should_execute_without_wait' panicked at 'assertion failed: millis_elapsed(start) <= 5', tests/integration_test.rs:56:5
stack backtrace:
0: 0x550008e438 - std::backtrace_rs::backtrace::libunwind::trace::hda657801c412a178
at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
1: 0x550008e438 - std::backtrace_rs::backtrace::trace_unsynchronized::ha5cf1c0cc7b28d87
at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x550008e438 - std::sys_common::backtrace::_print_fmt::h06f4428783169e20
at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/std/src/sys_common/backtrace.rs:67:5
3: 0x550008e438 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hbd0b65b71b30cbfa
at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/std/src/sys_common/backtrace.rs:46:22
4: 0x55000aa024 - core::fmt::write::hd6f2f4af62bce3bf
at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/core/src/fmt/mod.rs:1092:17
5: 0x550008818c - std::io::Write::write_fmt::ha49aaf2a7ffaeb5c
at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/std/src/io/mod.rs:1572:15
6: 0x5500090488 - std::sys_common::backtrace::_print::hac02f6d3130c889e
at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/std/src/sys_common/backtrace.rs:49:5
7: 0x5500090488 - std::sys_common::backtrace::print::hf0f7bc9e2e1ec9fe
at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/std/src/sys_common/backtrace.rs:36:9
8: 0x5500090488 - std::panicking::default_hook::{{closure}}::h6906422a8d9cd315
at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/std/src/panicking.rs:208:50
9: 0x550008ffc0 - std::panicking::default_hook::h249340b3b0e2b967
at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/std/src/panicking.rs:222:9
10: 0x5500090a64 - std::panicking::rust_panic_with_hook::hfacf5c096789c749
at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/std/src/panicking.rs:591:17
11: 0x55000905f4 - std::panicking::begin_panic_handler::{{closure}}::h9fe6008fcc526910
at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/std/src/panicking.rs:495:13
12: 0x550008e8a8 - std::sys_common::backtrace::__rust_end_short_backtrace::h14e2d4a0ec7cd5ed
at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/std/src/sys_common/backtrace.rs:141:18
13: 0x5500090588 - rust_begin_unwind
at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/std/src/panicking.rs:493:5
14: 0x5500015750 - core::panicking::panic_fmt::he3e4e24148ccccf4
at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/core/src/panicking.rs:92:14
15: 0x55000156d4 - core::panicking::panic::h10de7e903b95002f
at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/core/src/panicking.rs:50:5
16: 0x5500016560 - integration_test::should_execute_without_wait::hc987e53b31165050
at /work/source/tests/integration_test.rs:56:5
17: 0x5500016490 - integration_test::should_execute_without_wait::{{closure}}::h0796158b6d016d1e
at /work/source/tests/integration_test.rs:48:1
18: 0x5500020c64 - core::ops::function::FnOnce::call_once::h1853cc29f09ccc98
at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/core/src/ops/function.rs:227:5
19: 0x55000576c0 - core::ops::function::FnOnce::call_once::hc614cfda2d76a421
at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/core/src/ops/function.rs:227:5
20: 0x55000576c0 - test::__rust_begin_short_backtrace::h3782a60a0c46ece1
at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/test/src/lib.rs:567:5
21: 0x55000563b8 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h114659ff9311b761
at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/alloc/src/boxed.rs:1546:9
22: 0x55000563b8 - <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::h6d8f493d6ab774de
at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/std/src/panic.rs:344:9
23: 0x55000563b8 - std::panicking::try::do_call::h00b2d6daface8b3a
at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/std/src/panicking.rs:379:40
24: 0x55000563b8 - std::panicking::try::h424df84fd72e5d4a
at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/std/src/panicking.rs:343:19
25: 0x55000563b8 - std::panic::catch_unwind::h735f98ec1ddd14b1
at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/std/src/panic.rs:431:14
26: 0x55000563b8 - test::run_test_in_process::hd98fe513aee31462
at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/test/src/lib.rs:589:18
27: 0x55000563b8 - test::run_test::run_test_inner::{{closure}}::h64f247ac1bfeb38e
at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/test/src/lib.rs:486:39
28: 0x5500035ae4 - test::run_test::run_test_inner::{{closure}}::h850a7b5ab90773f3
at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/test/src/lib.rs:511:37
29: 0x5500035ae4 - std::sys_common::backtrace::__rust_begin_short_backtrace::h8330955d6196bd5c
at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/std/src/sys_common/backtrace.rs:125:18
30: 0x550003a340 - std::thread::Builder::spawn_unchecked::{{closure}}::{{closure}}::h858cd23d2ab84db0
at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/std/src/thread/mod.rs:474:17
31: 0x550003a340 - <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::h8b6676efe30f1133
at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/std/src/panic.rs:344:9
32: 0x550003a340 - std::panicking::try::do_call::h5422fdfdb0191ed8
at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/std/src/panicking.rs:379:40
33: 0x550003a340 - std::panicking::try::h99380dad0c88fe3c
at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/std/src/panicking.rs:343:19
34: 0x550003a340 - std::panic::catch_unwind::h2a5ad8f0807b9bc9
at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/std/src/panic.rs:431:14
35: 0x550003a340 - std::thread::Builder::spawn_unchecked::{{closure}}::hf9e63a3826fa6fc0
at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/std/src/thread/mod.rs:473:30
36: 0x550003a340 - core::ops::function::FnOnce::call_once{{vtable.shim}}::h0af8eb1afa95af3e
at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/core/src/ops/function.rs:227:5
37: 0x5500095d38 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h256369ac5fdc57d7
at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/alloc/src/boxed.rs:1546:9
38: 0x5500095d38 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hc713c7cbccbe973f
at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/alloc/src/boxed.rs:1546:9
39: 0x5500095d38 - std::sys::unix::thread::Thread::new::thread_start::hcdb827e8c49af92b
at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/std/src/sys/unix/thread.rs:71:17
40: 0x5501aaa7e4 - start_thread
41: 0x5501a00adc - <unknown>
42: 0x0 - <unknown>
failures:
should_execute_without_wait
test result: FAILED. 15 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 2.23s
error: test failed, to rerun pass '--test integration_test'
I do appear to be able to get the tests to pass if I exclude should_execute_without_wait
from the full set of tests, and it also appears to pass on its own:
docker run --rm -i --platform linux/arm64 --workdir /work --env WAIT_VERSION=2.9.0 rust:1.52.1-buster bash -s <<'EOF'
set -euo pipefail
set -x
git clone https://github.com/ufoscout/docker-compose-wait.git source
cd source
git checkout "${WAIT_VERSION}"
R_TARGET="$( rustup target list --installed | grep -- '-gnu' | tail -1 | awk '{print $1}'| sed 's/gnu/musl/' )"
rustup target add "$R_TARGET"
cargo test should_execute_without_wait -- --exact
cargo test -- --skip should_execute_without_wait
cargo build --release --target="$R_TARGET"
strip ./target/"$R_TARGET"/release/wait
target/"$R_TARGET"/release/wait
EOF
Output:
+ git clone https://github.com/ufoscout/docker-compose-wait.git source
Cloning into 'source'...
+ cd source
+ git checkout 2.9.0
Note: checking out '2.9.0'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b <new-branch-name>
HEAD is now at 5098f22 Merge pull request #52 from ufoscout/feature/wait_for_path
++ rustup target list --installed
++ grep -- -gnu
++ tail -1
++ awk '{print $1}'
++ sed s/gnu/musl/
+ R_TARGET=aarch64-unknown-linux-musl
+ rustup target add aarch64-unknown-linux-musl
info: downloading component 'rust-std' for 'aarch64-unknown-linux-musl'
info: installing component 'rust-std' for 'aarch64-unknown-linux-musl'
info: using up to 500.0 MiB of RAM to unpack components
+ cargo test should_execute_without_wait -- --exact
Updating crates.io index
Downloading crates ...
Downloaded atomic-counter v1.0.1
Downloaded port_check v0.1.5
Downloaded rand_core v0.6.2
Downloaded cfg-if v1.0.0
Downloaded rand_chacha v0.3.0
Downloaded rand v0.8.3
Downloaded ppv-lite86 v0.2.10
Downloaded libc v0.2.94
Downloaded log v0.4.14
Downloaded lazy_static v1.4.0
Downloaded getrandom v0.2.2
Downloaded env_logger v0.8.3
Compiling cfg-if v1.0.0
Compiling libc v0.2.94
Compiling log v0.4.14
Compiling getrandom v0.2.2
Compiling port_check v0.1.5
Compiling ppv-lite86 v0.2.10
Compiling lazy_static v1.4.0
Compiling atomic-counter v1.0.1
Compiling env_logger v0.8.3
Compiling wait v2.9.0 (/work/source)
Compiling rand_core v0.6.2
Compiling rand_chacha v0.3.0
Compiling rand v0.8.3
Finished test [unoptimized + debuginfo] target(s) in 2m 12s
Running unittests (target/debug/deps/wait-9844c520be7e6e56)
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 11 filtered out; finished in 0.00s
Running unittests (target/debug/deps/wait-060dd7f6789cdbf7)
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Running tests/integration_test.rs (target/debug/deps/integration_test-330808617b3ccde1)
running 1 test
test should_execute_without_wait ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 15 filtered out; finished in 0.04s
+ cargo test -- --skip should_execute_without_wait
Finished test [unoptimized + debuginfo] target(s) in 0.48s
Running unittests (target/debug/deps/wait-9844c520be7e6e56)
running 11 tests
test sleeper::test::should_not_wait ... ok
test test::should_return_int_value ... ok
test env_reader::test::should_return_an_env_variable ... ok
test test::should_return_zero_when_empty_value ... ok
test test::should_return_zero_when_invalid_value ... ok
test test::config_should_use_default_values ... ok
test test::should_return_zero_when_negative_value ... ok
test test::should_get_default_config_values ... ok
test test::should_get_config_values_from_env ... ok
test env_reader::test::should_return_the_default_value_if_env_variable_not_present ... ok
test sleeper::test::should_wait_for_a_second ... ok
test result: ok. 11 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 3.06s
Running unittests (target/debug/deps/wait-060dd7f6789cdbf7)
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Running tests/integration_test.rs (target/debug/deps/integration_test-330808617b3ccde1)
running 15 tests
test should_exit_on_path_timeout ... ok
test should_exit_on_host_timeout ... ok
test should_wait_before_and_after ... ok
test should_wait_for_10_seconds_after ... ok
test should_wait_for_5_seconds_before ... ok
test should_identify_the_open_port ... ok
test should_fail_if_not_all_hosts_are_available ... ok
test should_fail_if_hosts_are_available_but_paths_are_not ... ok
test should_wait_for_multiple_hosts ... ok
test should_fail_if_paths_are_available_but_hosts_are_not ... ok
test should_wait_for_multiple_paths ... ok
test should_fail_if_not_all_paths_are_available ... ok
test should_wait_for_multiple_hosts_and_paths ... ok
test should_sleep_the_specified_time_between_host_checks ... ok
test should_sleep_the_specified_time_between_path_checks ... ok
test result: ok. 15 passed; 0 failed; 0 ignored; 0 measured; 1 filtered out; finished in 2.19s
Doc-tests wait
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
+ cargo build --release --target=aarch64-unknown-linux-musl
Compiling log v0.4.14
Compiling cfg-if v1.0.0
Compiling port_check v0.1.5
Compiling env_logger v0.8.3
Compiling wait v2.9.0 (/work/source)
Finished release [optimized] target(s) in 1m 12s
+ strip ./target/aarch64-unknown-linux-musl/release/wait
+ target/aarch64-unknown-linux-musl/release/wait
[INFO wait] --------------------------------------------------------
[INFO wait] docker-compose-wait 2.9.0
[INFO wait] ---------------------------
[DEBUG wait] Starting with configuration:
[DEBUG wait] - Hosts to be waiting for: []
[DEBUG wait] - Paths to be waiting for: []
[DEBUG wait] - Timeout before failure: 30 seconds
[DEBUG wait] - TCP connection timeout before retry: 5 seconds
[DEBUG wait] - Sleeping time before checking for hosts/paths availability: 0 seconds
[DEBUG wait] - Sleeping time once all hosts/paths are available: 0 seconds
[DEBUG wait] - Sleeping time between retries: 1 seconds
[DEBUG wait] --------------------------------------------------------
[INFO wait] docker-compose-wait - Everything's fine, the application can now start!
[INFO wait] --------------------------------------------------------
From what I can glean from https://github.com/ufoscout/docker-compose-wait/blob/2.9.0/tests/integration_test.rs#L459-L477, this is what the test is attempting to do:
env \
WAIT_HOSTS="" \
WAIT_PATHS="" \
WAIT_TIMEOUT=1 \
WAIT_BEFORE=0 \
WAIT_AFTER=0 \
WAIT_SLEEP_INTERVAL=1 \
WAIT_HOST_CONNECT_TIMEOUT=1 \
./wait
And it runs without issue for me.
Given the above, would it be okay to run this binary in a production environment?
Hi @alanivey
It seems to me that the issue is simply caused by the fact that the tests run too slow on that target.
The test that fails, in fact, prints:
Millis elapsed 35
thread 'should_execute_without_wait' panicked at 'assertion failed: millis_elapsed(start) <= 5', tests/integration_test.rs:56:5
so it runs on 35 ms but it was supposed to run in less than 5 ms. As I usually execute them in a fast machine, I have never had this issue before. Anyway, I agree that it is not a particularly well-written test and I should write it in a more robust way.
Maybe that if you execute the tests in release mode, they could all pass as they will run much faster.
In conclusion, I don't see any issue with using your executable in a production environment.
If it's helpful for others, this is in my Dockerfile:
FROM docker.io/rust:1.52.1-buster as wait-builder
ARG WAIT_VERSION=2.9.0
WORKDIR /work
RUN set -eux; \
dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \
if [ "$dpkgArch" = "amd64" ]; \
then \
wget "https://github.com/ufoscout/docker-compose-wait/releases/download/${WAIT_VERSION}/wait"; \
chmod --changes 0755 wait; \
else \
git clone https://github.com/ufoscout/docker-compose-wait.git source; \
cd source; \
git checkout "${WAIT_VERSION}"; \
R_TARGET="$( rustup target list --installed | grep -- '-gnu' | tail -1 | awk '{print $1}'| sed 's/gnu/musl/' )"; \
rustup target add "$R_TARGET"; \
cargo test -- \
--skip should_execute_without_wait \
--skip should_exit_on_host_timeout \
--skip should_sleep_the_specified_time_between_host_checks \
--skip should_sleep_the_specified_time_between_path_checks \
; \
cargo build --release --target="$R_TARGET"; \
strip ./target/"$R_TARGET"/release/wait; \
install -v -m 0755 ./target/"$R_TARGET"/release/wait ..; \
cd ..; \
fi; \
./wait