-
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 deploy targets on all deployment platforms (docker, linux/ubuntu, windows, macos) #10
Comments
Added the ability to override `tests/bin/agent/start.test.ts` to target a docker image for testing. 3 env variables need to be set to facilitate this. `PK_TEST_DOCKER_IMAGE=$image`, `PK_TEST_COMMAND=scripts/docker-run.sh`, and `PK_TEST_COMMAND_DOCKER=DOCKER`. The dataDir in each tests needs to be set via env with `PK_TEST_DATA_PATH: dataDir`. The `integration:docker` CI/CD job has been updated to use these tests. Related #389
Added the ability to override `tests/bin/agent/start.test.ts` to target a docker image for testing. 3 env variables need to be set to facilitate this. `PK_TEST_DOCKER_IMAGE=$image`, `PK_TEST_COMMAND=scripts/docker-run.sh`, and `PK_TEST_COMMAND_DOCKER=DOCKER`. The dataDir in each tests needs to be set via env with `PK_TEST_DATA_PATH: dataDir`. The `integration:docker` CI/CD job has been updated to use these tests. Related #389
The spec for this needs to be fleshed out with respect to:
Make this issue an epic, rename it, and create 3 subissues for docker, windows and mac. Then in your PR, target them one at a time, or target all 3. Probably all 3 targets and then @emmacasolin can join you in the same PR to work out all the bug fixes. |
We also need to spec out the changes to the utility functions of |
The docker integration tests will have different namespace behaviour:
Need to see if the CI/CD job can actually do mount binding with |
Because this will also depend on test fixes for mac and windows at the |
Ok so let's focus on docker as a priority. So @tegefaulkes and @emmacasolin will work together in a pipeline on docker and testnet integration. One to work any bug/test failures with doing docker testing (and associated source code changes). The other to work on integration to Because testnet ultimately requires the docker integration to be working, this is good way of focusing on fixing up one area of the application of PK. |
I've added MatrixAI/Polykey#432 to track standardisation of the |
Moving to Polykey-CLI. |
The mac and windows bulding in CI are working again. But to address this we need to add integration tests for mac, win and linux. They don't need to be complex. We can use the docker integration tests as a template and they're only testing start and connecting to a network. |
Specification
after creating the packaged executable using
pkg
we need to run a variety of tests on it. We need to do this in all of the main environments such as Linux, windows and MAC. We will also need to test the docker image but I'm nut sure the same tests can apply in that case.All of the main tests we need to do are already done by the bin tests. So we just need to repurpose all or a subset of these tests and run them on the target platform. Assuming the tests themselves don't need some kind of modification to work on the target platforms. Then the only changes to the tests that need to be made are to exec the packaged executable instead of the ts/js code.
Keep in mind that most of the tests don't actually exec pk to run them but are run in thread using mocks to capture output. With that in mind we will need to review the tests to see if any of them require access to the thread to apply mocks for the tests. We may also apply a subset of the tests to run instead of running all of them.
I think we can prioritise the tests based on complexity. starting with just running
Polykey
to full integration. I think the stages go as follows.We will need a way to specify that we are running the tests targeting the packaged executable. This will be specified as a global however it will be set via and env variable. So the global check the env and provides the parameter to the tests.
The tests will need to check the target and change it's behaviour based on that. First by changing modifying how the commands are run. The utility functions
pkStdio
,pkExec
andpkSpawn
will need to be modified to run the packaged target if that global parameter is set. The functions will need to function with the same API so the the new behaviour will be a drop in replacement.Most tests utilise
okStdio
which is running the command 'in thread' with mocking. This could be a problem because if any tests is doing mocking on the command itself then we can't run it in a separate thread using exec. This means the test itself could be incompatible with testing the packaged executable. Either a change to the test needs to be made or the test needs to be filtered out when testing the packaged executable. This is unlikely to be a problem since there seems to be little mocking and any mocking will be done against the polykey instance running 'in thread' anyway.Additional context
Tasks
The text was updated successfully, but these errors were encountered: