dynein
dynein copied to clipboard
Add a flag DYNEIN_TEST_NO_DOCKER_SETUP to prevent launching docker container on testing
Issue #56, if available:
Description of changes:
If you specify DYNEIN_TEST_NO_DOCKER_SETUP=true
on environment variable, cargo test
does not start docker container on testing.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Force pushed to execute cargo fmt
.
I apologize that I didn't recognize the related issue #56 . I'll post comments after reading it. Please wait a moment.
I looked through the related issues #55 #56 #57 #58 and discussed with @StoneDot . Thanks for your great contribution for the integration tests on GitHub Actions!
Summary of discussion
In GitHub Actions, when running jobs directly on the runner machine, we can access service containers using localhost:<port>
or 127.0.0.1:<port>
.
https://docs.github.com/en/actions/using-containerized-services/about-service-containers#running-jobs-on-the-runner-machine
On the other hand, check_dynamodb_local_running()
uses docker ps
command to check whether containers are ready. Therefore, check_dynamodb_local_running()
cannot check whether service containers on GitHub Actions (not local docker containers) are ready.
In conclusion, DYNEIN_TEST_NO_DOCKER_SETUP
is required for integration tests on GitHub Actions.
Request
Could you add comments to source code that this flag is for the non-local docker container use case (e.g. CI/CD on GitHub Actions, custom endpoints in future enhancement)?
@StoneDot You could also run this to skip integration tests altogether:
❯ cargo test --bins
Finished test [unoptimized + debuginfo] target(s) in 0.12s
Running unittests (target/debug/deps/dy-796db90becd647d8)
running 3 tests
test shell::tests::test_parse_ok ... ok
test app::tests::test_context_functions ... ok
test shell::tests::test_parse_ng ... ok
test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Update: never mind, I misunderstood the goal of this issue. :)
@zulinx86 I'm sorry for the delay in fixing this. Could you check this PR?