Introduce test-integration target#34000
Conversation
hack/make/.integration-daemon-start
Outdated
There was a problem hiding this comment.
Setting a trap from some random function is not really correct or safe in bash. There can be only one trap per signal so this could override some other trap, or be overridden anywhere.
Instead the new script runs in a subshell and always runs cleanup even if the subshell exits non-zero.
Looking at that error, somehow there you miss the load of the image 👼 |
|
Ya, the question is how 😄 I verified that the script still runs. I need to look into it further |
|
As in #33987, I was not able to verify functionality. The script changes taken for themselves LGTM. |
f3e8ed3 to
a3f7e7c
Compare
|
Ok, the problem was the TODO about protecting images. Now the new suite will protect existing images as well. |
|
|
|
Build is green, this is ready for review |
aaronlehmann
left a comment
There was a problem hiding this comment.
I still think it is better to rename integration-cli to integration and make gradual improvements to it. I think if we establish a second set of tests it will lead to a lot of confusion (lack of clarity on where coverage for a particular feature exists, risk of overlapping coverage, people adding new tests to integration-cli instead of integration, etc). See #33344 (comment)
hack/make/.integration-test-helpers
Outdated
There was a problem hiding this comment.
Oops, I had this as pushd and forgot to remove the > /dev/null when i changed it back to cd. Will remove it
hack/make/.integration-test-helpers
Outdated
There was a problem hiding this comment.
Does it make sense to build a binary for each package? I imagine that each binary will be quite large, so this may take a lot of space and could be fairly slow.
I believe we prebuild the integration-cli binary as a convenience so that syntax errors are caught before the dockerd binary is built. If there are going to be many binaries, maybe this doesn't make sense anymore, and it would be better to invoke tests with go test after the daemon is running.
There was a problem hiding this comment.
Also, is there value in separating the integration tests into different packages if the script doesn't let you build/test packages individually?
There was a problem hiding this comment.
Does it make sense to build a binary for each package?
I think the advantages out-weight the single disadvantage (disk space which is recovered when the test run ends).
I imagine that each binary will be quite large, so this may take a lot of space
Yes, I think this is the only disadvantage. I don't think the disk space will be all that significant, but it will definitely grow as we add more packages. I expect it might take 200M or so once we have everything split into separate packages. If it becomes an issue we can add a flag to disable the build-first so they can be cleaned up after each package suite runs, assuming 200M actually becomes a problem for someone. Right now I don't think it's worth adding that complexity.
and could be fairly slow
It shouldn't be any slower than running the complete test suite. go test builds this binary anyway, it just hides it. When we add support for only running specific packages it will be trivial to only build the binaries we are going to run. For now it's not any slower than not pre-building them, and it lets us fail fast when there are syntax errors, which is a big win.
I believe we prebuild the integration-cli binary as a convenience so that syntax errors are caught before the dockerd binary is built.
Not before the dockerd binary is built, but before we run the slow test setup parts of starting the daemon and loading in fixtures.
If there are going to be many binaries, maybe this doesn't make sense anymore, and it would be better to invoke tests with go test after the daemon is running.
If anything it's more important now. I don't want to run half the test suite then have it die because of a syntax error. It should build all the binaries first, then setup the environment, and finally run the tests. When we support running one package (or a subset of packages) at a time we can make sure it only builds the appropriate binaries. That feature should be easy to implement, just allow integration_api_dirs to be set by the user.
is there value in separating the integration tests into different packages if the script doesn't let you build/test packages individually?
Yes, I think there is a lot of value in this, it's one of the more important parts of this change. In the future, when we have more packakges, we can enable support for build/testing a single package or a subset of packages (as mentioned it should be really easy to add).
Until then I believe we still benefit from improved caching. As I understand it, if a package isn't modified go is able to use a cached version of it. By having more packages (as long as the packages are well separated) we know that all but one package should be cached on most runs. This should greatly reduce the startup time of the integration test suite (even without the further optimisation of running just a single package).
The task/target has already been renamed, so I guess you mean rename the package? I think keeping a single package and just renaming makes all the problems worse.
I think mixing them will lead to a lot more confusion. By having two suites it is easier to communicate and discover what is legacy and what is the new way of writing an integration test. If we mix them it becomes a lot more difficult for users to discover correct examples. They'll mostly see a bunch of bad examples of the old way of doing things. It's much easier to say "everything in Mixing the suites would also prevent us from doing a bunch of other necessary cleanup (splitting into multiple packages, ditching gocheck, improving the test setup/teardown). We can setup checks that ensure no new tests are added to the old suite and that no tests in the new suite use the CLI.
This is already a major problem with Adding a new suite will actually improve the situation. We will setup a pattern where tests are split into packages by component, and files by feature. That way all the tests for a specific feature are in the same file. This doesn't solve the problem of overlap with
I don't think this will be a problem. We should be able to communicate to all maintainers of this repo that nothing should be added to integration-cli. We can also write a |
0f8fb5b to
ab4a484
Compare
7877a99 to
cad56e4
Compare
cad56e4 to
1b7ffb9
Compare
|
I think this changes make sense. ping @moby/moby-maintainers let's move this forward |
|
Agreed, +1 |
Dockerfile
Outdated
There was a problem hiding this comment.
@dnephin I understand that we're deprecating test-integration-cli, but I'm not sure I would like people to not run them just yet.
There was a problem hiding this comment.
They are still run by test-integration it's just a new target name to better reflect the suite
mlaventure
left a comment
There was a problem hiding this comment.
LGTM
the cd integration-cli > /dev/null nit, is of no consequence to me ;-)
…ration-cli`) This adds a new package `integration` where `engine` integration tests should live. Those integration tests should not depends on any `cli` components (except from the `dockerd` daemon for now — to actually start a daemon). Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Signed-off-by: Daniel Nephin <dnephin@docker.com>
Signed-off-by: Daniel Nephin <dnephin@docker.com>
1b7ffb9 to
e593b72
Compare
Signed-off-by: Daniel Nephin <dnephin@docker.com>
|
ping @tiborvass |
|
LGTM |
Carry #33344
Addressed the feedback from #33344 and made some more changes to the hack scripts.
There is a single test target
test-integrationwhich runs all the new packages, as well as the old integration-cli package.Not many test code changes yet. I'd like to merge the hack changes first, and iterate on the tests.
Also cleaned up verbose test output, can be enabled with
TESTDEBUG=1