dynein icon indicating copy to clipboard operation
dynein copied to clipboard

Add a flag DYNEIN_TEST_NO_DOCKER_SETUP to prevent launching docker container on testing

Open StoneDot opened this issue 3 years ago • 4 comments

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.

StoneDot avatar Dec 05 '21 08:12 StoneDot

Force pushed to execute cargo fmt.

StoneDot avatar Dec 05 '21 08:12 StoneDot

I apologize that I didn't recognize the related issue #56 . I'll post comments after reading it. Please wait a moment.

ghost avatar Dec 06 '21 04:12 ghost

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)?

ghost avatar Dec 06 '21 05:12 ghost

@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. :)

mlafeldt avatar Feb 11 '22 13:02 mlafeldt

@zulinx86 I'm sorry for the delay in fixing this. Could you check this PR?

StoneDot avatar May 29 '23 08:05 StoneDot