Import TestBuildIidFileSquash from moby to cli#990
Conversation
e2e/compose-env.yaml
Outdated
| image: 'docker:${TEST_ENGINE_VERSION:-edge-dind}' | ||
| privileged: true | ||
| command: ['--insecure-registry=registry:5000'] | ||
| command: ['--insecure-registry=registry:5000', '--experimental'] |
There was a problem hiding this comment.
Doesn't this change the whole test suite?
There was a problem hiding this comment.
@cpuguy83 yes it does. I think it's fine right now, but we way want to run e2e test against experimental and non-experimental job, but then the changes would be heavier.
There was a problem hiding this comment.
The test would also need to ensure that experimental is enabled.
I think it may be prudent to support both modes in e2e and then skip tests that require experimental on non-experimental daemons rather than changing the suite for this test.
thaJeztah
left a comment
There was a problem hiding this comment.
test LGTM, but the --experimental change may need to be discussed
|
ping @cpuguy83 this good to go, or want changes w.r.t. the experimental option? |
|
I'm more worried about changing to only testing experimental than I am about having this test. |
|
ok, let's hold off merging to see if we can find a solution for that first |
|
@cpuguy83 @thaJeztah should I go for "skip tests that require experimental on non-experimental" and in a follow-up update the e2e run to support being run in |
|
SGTM for now (if we do the reverse as well, i.e. skip regular tests if experimental is enabled), we could just run them after each other? |
Ah right |
762ec3e to
3bea26e
Compare
|
Updated # […]
--- SKIP: TestBuildIidFileSquash (0.01s)
build_test.go:106: !info.ExperimentalBuild: running against a non-experimental daemon
# […] |
3bea26e to
eb32506
Compare
|
And now with an additionnal commit : |
|
|
||
| .PHONY: test-e2e | ||
| test-e2e: binary | ||
| test-e2e: test-e2e-non-experimental test-e2e-experimental |
There was a problem hiding this comment.
Would be nice to have a make help in this makefile as well (definitely not for this PR though 😄)
dockerfiles/Dockerfile.test-e2e-env
Outdated
| WORKDIR /work | ||
| COPY scripts/test/e2e scripts/test/e2e | ||
| COPY e2e/compose-env.yaml e2e/compose-env.yaml | ||
| COPY e2e/compose-env.yaml.experimental e2e/compose-env.yaml.experimental |
There was a problem hiding this comment.
compose-env-experimental.yaml
There was a problem hiding this comment.
I used that to be able to do the file="${file}:${file}.experimental" hack 😛
e2e/compose-env.yaml.experimental
Outdated
| @@ -0,0 +1,6 @@ | |||
| version: '2.1' | |||
There was a problem hiding this comment.
See above:
s/compose-env.yaml.experimental/compose-env-experimental.yaml/
e2e/compose-env.yaml.experimental
Outdated
|
|
||
| services: | ||
| engine: | ||
| command: ['--insecure-registry=registry:5000', '--experimental'] |
There was a problem hiding this comment.
Should this be with double-quotes (JSON notation)?
["--insecure-registry=registry:5000", "--experimental"]796b0f6 to
507ee91
Compare
507ee91 to
3ea53e7
Compare
|
@thaJeztah this one should be ready, it does two e2e runs, one with experimental, the other without. |
scripts/test/e2e/run
Outdated
| local file=./e2e/compose-env.yaml | ||
|
|
||
| DOCKERD_EXPERIMENTAL="${DOCKERD_EXPERIMENTAL:-}" | ||
| test -n "${DOCKERD_EXPERIMENTAL}" && file="${file}:./e2e/compose-env.experimental.yaml" |
There was a problem hiding this comment.
The calling code uses DOCKERD_EXPERIMENTAL=0, which also passes the test above -- not what you wanted I think?
scripts/test/e2e/wrapper
Outdated
| # Setup, run and teardown e2e test suite in containers. | ||
| set -eu -o pipefail | ||
|
|
||
| echo "exp $DOCKERD_EXPERIMENTAL" |
There was a problem hiding this comment.
Is this leftover debug? If not then due to set -u above if DOCKERD_EXPERIMENTAL is not set it'll error out I think.
ijc
left a comment
There was a problem hiding this comment.
The test itself LGTM. I had some minor comments on the scaffolding.
2a528bb to
dc3929f
Compare
|
@thaJeztah @ijc updated 😅 |
ijc
left a comment
There was a problem hiding this comment.
Test itself still looks A-OK but one query and one very minor nit on the infrastructure.
scripts/test/e2e/run
Outdated
| local file=./e2e/compose-env.yaml | ||
|
|
||
| DOCKERD_EXPERIMENTAL="${DOCKERD_EXPERIMENTAL:-}" | ||
| test "${DOCKERD_EXPERIMENTAL}" -eq "1" && file="${file}:./e2e/compose-env.experimental.yaml" |
There was a problem hiding this comment.
Unless you wanted to subsequently export it you could inline the ${DOCKERD_EXPERIMENTAL:-} into the usage in the test, but that's a very minor nit.
scripts/test/e2e/run
Outdated
| function setup { | ||
| local project=$1 | ||
| COMPOSE_PROJECT_NAME=$1 COMPOSE_FILE=$2 docker-compose up --build -d >&2 | ||
| local file=./e2e/compose-env.yaml |
There was a problem hiding this comment.
Previously $file would (logically) have been $2 but here you seem to have expanded/inlined it without changing the caller AFAICT.
dc3929f to
f5fabf2
Compare
thaJeztah
left a comment
There was a problem hiding this comment.
overall looks good; left a nit and a question
| FROM %s | ||
| ENV FOO FOO | ||
| ENV BAR BAR | ||
| RUN touch /foop`, fixtures.AlpineImage)), |
There was a problem hiding this comment.
Looks like this Dockerfile will only add a single layer; should we have something that actually has multiple layers before squashing?
(If there's some specific case we're testing for, we may need a comment to describe that case)
There was a problem hiding this comment.
Oh good point. I took the test case from moby/moby but yeah we could add one more RUN to it 😉
There was a problem hiding this comment.
The original issue was moby/moby#33822, which lead to moby/moby#33824.
Rereading that I think the number of layers was not the issue, just the wrong thing was being returned.
There was a problem hiding this comment.
Ah, thanks!
@vdemeester @ijc do think it would be good to add that as a comment/godoc for the test, so that the original intent doesn't get lost?
e2e/compose-env.experimental.yaml
Outdated
|
|
||
| services: | ||
| engine: | ||
| command: ['--insecure-registry=registry:5000', '--experimental'] |
There was a problem hiding this comment.
looks like my previous comment got collapsed; #990 (comment)
(nit); was wondering if we should prefer to use double-quotes here to be consistent with the Dockerfile format
There was a problem hiding this comment.
Ah, I don't really care so I can switch to " 😉
It's a cli only feature so the test belongs to the cli. Signed-off-by: Vincent Demeester <vincent@sbr.pm>
- `make test-e2e` runs the e2e tests twice : once against on non-experimental daemon (as before), once against an experimental daemon. - adds `test-e2e-experimental` and `test-e2e-non-experimental` target to run tests for the specified cases Signed-off-by: Vincent Demeester <vincent@sbr.pm>
f5fabf2 to
a522a78
Compare
|
@thaJeztah updated 🎐 |
It's a cli only feature so the test belongs to the cli.
See https://github.com/moby/moby/pull/36746/files#diff-64d1c3a97fd8b1abf170680883e81aaaL6241
cc @dnephin
It also make test-e2e run against experimental and non-experimental daemon.
Signed-off-by: Vincent Demeester vincent@sbr.pm