-
Notifications
You must be signed in to change notification settings - Fork 4
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
Integration tests for docker image #407
Comments
So we're running into the quirks of using DIND to run our container. Currently the problem is how mounting the host FS works. Since we're running the This means I can't actually specify the temp file directory for the docker to run since we can't actually create it for the container. I'm not sure there is a way for us to share the file system between the main container and the DIND service. That leaves us with the following options.
The simpler solution for now is just only do tests that don't require directly accessing the contents of the agent's directory. This is a pretty big restriction however since the docker image is just running the raw node code we don't need to be as exhaustive in the testing here. We only need a limited amount of tests to act as a sanity check. |
Nice comment about the problem Here https://gitlab.com/gitlab-org/gitlab-foss/-/issues/41227#note_52029664 a possible solution mentioned here is using variables:
SHARED_PATH: /builds/shared/$CI_PROJECT_PATH I'll look into this. Update: Yep, looks like this works. |
The next comment is also insightful: https://gitlab.com/gitlab-org/gitlab-foss/-/issues/41227#note_52092575 |
And also https://gitlab.com/gitlab-org/gitlab-foss/-/issues/41227#note_128388116... seems like there's a few ways. |
Sweet, it's working. In the recent test all but 1 of the |
Both the |
Converted all of the tests now. Just need to test them. |
I'm running into a problem that's making no sense. A lot of tests are just timing out, I'm pretty sure that the start tests are still working. I need to do some sanity checks. |
The sanity check has revealed that the command running inside the container can't connect to an agent running on host or another container. I'm exploring solutions. |
Is it a matter of mapping the right ports? Since we are using dind, both containers the client and the agent would be running in the dind container, so then ports have mapped to be non-conflicting. I also remember docker supports a sort of "link" or bridge between docker containers rather than port mapping. |
They should share the same default network if I remove The other problem is that some of the tests need to connect to a agent with mocking running on the test host. |
I said that in the CICD, that |
Yea so we need to get rid of any mocking. Integration tests will need to test with minimal mocking... It looks like linking is a legacy feature now. It is recommended to use "user defined networking":
Will these work in the CI/CD? Not sure. Have a try. |
Hey see these issues and this link:
The first link goes to: https://docs.gitlab.com/ee/ci/services/#connecting-services |
Also: https://docs.gitlab.com/runner/executors/docker.html#create-a-network-for-each-job There's some SAAS questions people asked: |
Inspecting the network with and without
|
This will remove the container when it ends. #407
Disabling tests that don't work with docker for now. #407
disabled some more tests with prompts mocking. Removed `sanity.test.ts` #407
- converting lock.test.ts - cleaning up `testIf` commands and envs - converted lockall.test.ts - converted status.test.ts - converted stop.test.ts - converted unlock.test.ts Related #407
Also enabled `FF_NETWORK_PER_BUILD` flag for CI. Related #407
This will remove the container when it ends. #407
Disabling tests that don't work with docker for now. #407
Also enabled `FF_NETWORK_PER_BUILD` flag for CI. Related #407
This will remove the container when it ends. #407
Disabling tests that don't work with docker for now. #407
Specification
This issue is to track the progress of PKG integration tests for the docker image.
A selection of bin tests need to be updated to support using the docker image as the target for testing.
The main tests that need to be updated in order are;
bin/agent/start.test.ts
bin/bootstrap.test.ts
bin/agent
bin/polykey.test.ts
Depending on the decided scope, the rest of the tests that could be updated are listed in MatrixAI/Polykey-CLI#10
Some things specific to docker that need to be checked refereed from https://github.com/MatrixAI/js-polykey/issues/389#issuecomment-1180048178.
--network host
, you'll need an IP address and Port mapping, make sure this works on the CI/CD too--pid host
you'll need handling of the signals by the PK agent--userns host
and--user "$(id -u)"
this may still be necessary locally, in order to allow the files written to be readable by the test code which is running as part of our local user. But on the CI/CD this both may be the root user. But experiment with this.Additional context
Tasks
testIf
to explicitly run the test if testing docker. Right now we implicitly running them by disabling the tests that are not supported for docker.bin/agent/start.test.ts
bin/bootstrap.test.ts
bin/agent
.env.example
with any changes to the required env vars.The text was updated successfully, but these errors were encountered: