-
Notifications
You must be signed in to change notification settings - Fork 505
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
\#1500 - prototype for using testcontainers-go for dependencies #1544
\#1500 - prototype for using testcontainers-go for dependencies #1544
Conversation
f1ee7ed
to
2dacc53
Compare
cc @gianarb |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ClaytonNorthey92 thanks for this! it's looking very promising so far 🎉. One note - we will need to change some of the local development documentation, the Makefile and the docker compose file - which is also used primarily for local development. Since the tests themselves are starting up all of the service dependencies, we won't need the Makefile/docker compose to do it before running tests.
cc/ @fedepaol because you were in the original discussion as well
f2085d0
to
f9e556a
Compare
@arschles I have added the workflows directory, based off of your gh-actions branch, here is the latest action running the tests (with testcontainers) |
okay I will address this as well @arschles 👍 |
05db8c1
to
31a7938
Compare
hey @arschles I have removed the dependencies from the let me know what you think edit: I think I still need to update the action to fail a "check" if the tests fail in the action...I don't think it is doing that now |
@ClaytonNorthey92 great, I missed that before. We probably need to turn these tests off in drone then. I'd say the best way to do that is with an environment variable that defaults to "on". Then, we can set it to off in drone.
what you said makes sense for the docker-compose file. I'm glad that things won't conflict!
I was thinking the same thing. When we merge this PR, tests will probably start failing in GH actions because there are some tokens missing that we need for connecting to various cloud services in our tests. I'll be sure to put those into GH actions secrets 👍 |
Hey @arschles thanks for the feedback 👍 I should have time to get back to this later this weekend, just wanted to let you know I saw your comments |
fbe5408
to
57947f1
Compare
hey @arschles I believe that these are the environment variables we need for cloud services tests?
I notice that in the tests, they are skipped if we do not have the environment variable needed to run them. Would you be able to add these environment variables to Github actions? Then we can re-run the checks and those tests should run and we can ensure that they pass. I have also removed testing from the |
@@ -22,15 +22,12 @@ services: | |||
args: | |||
GOLANG_VERSION: 1.13 | |||
command: ["./scripts/test_unit.sh"] | |||
volumes: | |||
- /var/run/docker.sock:/var/run/docker.sock # test this on windows, it might be different |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@arschles do you have a Windows machine? Could you ensure that the testunit
service works on Windows via the make command to run unit tests? If it fails, could you paste the error here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe it is make test-unit-docker
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can try, but let's try to get testcontainers-less appveyor tests back 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @ClaytonNorthey92, let me respond one by one:
Would you be able to add these environment variables to Github actions?
Absolutely. I will do so tomorrow.
What do you think?
About the drone tests, yea it seems like we need to move to GH actions to get this to work. This PR can close #1463 when it gets merged then
|
||
test_script: | ||
- go test ./... | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ClaytonNorthey92 we still need to run at least unit tests on windows. One idea would be to add an env var to turn off the testcontainers tests and set it in appveyor but not in GH actions. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so the issue here came from trying to start the reaper containers on windows (the containers that run and ensure that the containers we start get killed at the end of the tests), but you can optionally skip the reaper containers.
I think that since, according to appveyor's documentation, they don't preserve any VMs between builds, we can safely skip the reaper in appveyor tests. So I think we should add that env variable like TESTCONTAINERS_SKIP_REAPER
, if that is set to 1
then we skip the reaper builds and we should be okay (I think)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am testing this theory out now...I accidentally got a build stuck debugging...so I am going to wait for that to timeout and fail to keep on testing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hey @arschles how do you feel about putting integration tests into their own package? the using a build tag to ignore them by default, then you can pass in the tag to enable them? that should be able to be done just from the code and the config files and wouldn't require a change to the environment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine with me RE the different package. I'd rather have them enabled by default and pass a tag to disable them. Are you cool with that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah that makes sense to me, just need a way to cleanly include/not include them
I can work on this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just left a comment
run: go build cmd/proxy/*.go | ||
env: | ||
GOPROXY: https://proxy.golang.org | ||
GO111MODULE: "on" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ClaytonNorthey92 can you add a newline (with no indent) at the end of this file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just did 👍
@@ -22,15 +22,12 @@ services: | |||
args: | |||
GOLANG_VERSION: 1.13 | |||
command: ["./scripts/test_unit.sh"] | |||
volumes: | |||
- /var/run/docker.sock:/var/run/docker.sock # test this on windows, it might be different |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can try, but let's try to get testcontainers-less appveyor tests back 😄
@ClaytonNorthey92 I haven't forgotten about this. Things got busy this week. I can set up the secrets in GH actions early next week. I hope that's ok! 😄 |
@arschles yes of course, I see there are a few other comments here, I was going to address them this weekend, I have been a little too busy to look this week, but I will this weekend |
48e6f0c
to
6b90f8e
Compare
8e4ab29
to
3077638
Compare
@ClaytonNorthey92 Ok, all the GH Actions secrets are set up! Sorry for that delay 😄 One problem is that the secrets are not passed to PRs from a fork, for security's sake. The best option I can think of is to check for those env vars in the tests and skip if they're not there. What do you think? |
yeah that makes sense to me, I will make sure that I log out a warning when we skip though, sorry I haven't had time to look back at this, I will have time Saturday |
hey @arschles I started work on moving integration tests over to their own package...I am starting to not like the idea so much. The integration tests where they are use a lot of private attributes to test. For example, the mongo storage, the attribute what do you think? |
@ClaytonNorthey92 that sounds great. Except on the last part - if the variable is not set, can it just continue with the test and assume the service is already running? |
@arschles Yeah I can do that. I would also like to make their connection configurations (hosts, ports, etc) configurable via env variables. So then you could run the dependencies however you wanted (docker, just running the process locally, etc.) and set those environment variables so your test could connect to them, however you have them running. |
@ClaytonNorthey92 sounds great! We'll be around when you're ready 😄 ✌️ |
307674b
to
7a7c3d4
Compare
3f6822a
to
abd2732
Compare
Prototype for using testcontainers for dependencies: mongodb, minio, and redis squash me: use testcontainers in appveyor use newer vs attempt docker upgrade
abd2732
to
20cd8b1
Compare
hey @arschles I apologize I somewhat abandoned this pull request, ultimately, I couldn't find a great way past this build error when compiling the project on windows, the issue has since been fixed and I opened a pull request to testcontainers-go to ensure they don't use a version that can't compile on windows. This should fix the compilation issue that I mentioned, since that dependency is coming from the testcontainers-go project. However, even if that gets merged and this PR works and gets merged, I don't think I would have time to support this after it is merged. If you believe testcontainers-go is still worth pursuing I hope my work here will help jump-start whoever picks it up next. If I can help at all, please reach out 👍 |
@ClaytonNorthey92 thanks for your reply here - and no worries at all! 😄 |
What is the problem I am trying to address?
This is meant to be a prototype for using testcontainers for dependencies such as redis, minio, and mongo.
How is the fix applied?
In the tests, rather than checking if an env variable is set to run tests against these dependencies, I start docker containers with testcontainers in the tests themselves
Mention the issue number it fixes or add the details of the changes if it doesn't have a specific issue.
This prototype was mentioned in #1500 , this should not be merged (yet), it is just a proof of concept.
Fixes #1500
Edit by @arschles - added
Fixes
to this PR description so that it closes the issue when it's merged