Skip to content

Import TestBuildIidFileSquash from moby to cli#990

Merged
thaJeztah merged 2 commits intodocker:masterfrom
vdemeester:e2e-iddfile-from-moby
Jul 30, 2018
Merged

Import TestBuildIidFileSquash from moby to cli#990
thaJeztah merged 2 commits intodocker:masterfrom
vdemeester:e2e-iddfile-from-moby

Conversation

@vdemeester
Copy link
Collaborator

@vdemeester vdemeester commented Apr 9, 2018

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

image: 'docker:${TEST_ENGINE_VERSION:-edge-dind}'
privileged: true
command: ['--insecure-registry=registry:5000']
command: ['--insecure-registry=registry:5000', '--experimental']
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this change the whole test suite?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test LGTM, but the --experimental change may need to be discussed

Copy link
Contributor

@silvin-lubecki silvin-lubecki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@thaJeztah
Copy link
Member

ping @cpuguy83 this good to go, or want changes w.r.t. the experimental option?

@cpuguy83
Copy link
Collaborator

I'm more worried about changing to only testing experimental than I am about having this test.

@thaJeztah
Copy link
Member

ok, let's hold off merging to see if we can find a solution for that first

@vdemeester
Copy link
Collaborator Author

@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 experimental or not ?

@thaJeztah
Copy link
Member

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?

@vdemeester
Copy link
Collaborator Author

we could just run them after each other?

Ah right

@vdemeester vdemeester force-pushed the e2e-iddfile-from-moby branch from 762ec3e to 3bea26e Compare May 22, 2018 09:52
@vdemeester
Copy link
Collaborator Author

vdemeester commented May 22, 2018

Updated

# […]
--- SKIP: TestBuildIidFileSquash (0.01s)
	build_test.go:106: !info.ExperimentalBuild: running against a non-experimental daemon
# […]

@vdemeester vdemeester force-pushed the e2e-iddfile-from-moby branch from 3bea26e to eb32506 Compare May 22, 2018 09:56
@vdemeester
Copy link
Collaborator Author

And now with an additionnal commit :

Make test-e2e run against experimental and non-experimental daemon

- `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


.PHONY: test-e2e
test-e2e: binary
test-e2e: test-e2e-non-experimental test-e2e-experimental
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice to have a make help in this makefile as well (definitely not for this PR though 😄)

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

compose-env-experimental.yaml

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used that to be able to do the file="${file}:${file}.experimental" hack 😛

@@ -0,0 +1,6 @@
version: '2.1'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above:

s/compose-env.yaml.experimental/compose-env-experimental.yaml/


services:
engine:
command: ['--insecure-registry=registry:5000', '--experimental']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be with double-quotes (JSON notation)?

 ["--insecure-registry=registry:5000", "--experimental"]

@vdemeester vdemeester force-pushed the e2e-iddfile-from-moby branch 2 times, most recently from 796b0f6 to 507ee91 Compare May 22, 2018 12:45
@vdemeester vdemeester force-pushed the e2e-iddfile-from-moby branch from 507ee91 to 3ea53e7 Compare June 18, 2018 12:09
@vdemeester
Copy link
Collaborator Author

@thaJeztah this one should be ready, it does two e2e runs, one with experimental, the other without.

local file=./e2e/compose-env.yaml

DOCKERD_EXPERIMENTAL="${DOCKERD_EXPERIMENTAL:-}"
test -n "${DOCKERD_EXPERIMENTAL}" && file="${file}:./e2e/compose-env.experimental.yaml"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The calling code uses DOCKERD_EXPERIMENTAL=0, which also passes the test above -- not what you wanted I think?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤦‍♂️

# Setup, run and teardown e2e test suite in containers.
set -eu -o pipefail

echo "exp $DOCKERD_EXPERIMENTAL"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this leftover debug? If not then due to set -u above if DOCKERD_EXPERIMENTAL is not set it'll error out I think.

Copy link
Contributor

@ijc ijc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test itself LGTM. I had some minor comments on the scaffolding.

@vdemeester vdemeester force-pushed the e2e-iddfile-from-moby branch 2 times, most recently from 2a528bb to dc3929f Compare June 19, 2018 09:44
@vdemeester
Copy link
Collaborator Author

@thaJeztah @ijc updated 😅

Copy link
Contributor

@ijc ijc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test itself still looks A-OK but one query and one very minor nit on the infrastructure.

local file=./e2e/compose-env.yaml

DOCKERD_EXPERIMENTAL="${DOCKERD_EXPERIMENTAL:-}"
test "${DOCKERD_EXPERIMENTAL}" -eq "1" && file="${file}:./e2e/compose-env.experimental.yaml"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

function setup {
local project=$1
COMPOSE_PROJECT_NAME=$1 COMPOSE_FILE=$2 docker-compose up --build -d >&2
local file=./e2e/compose-env.yaml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously $file would (logically) have been $2 but here you seem to have expanded/inlined it without changing the caller AFAICT.

@vdemeester vdemeester force-pushed the e2e-iddfile-from-moby branch from dc3929f to f5fabf2 Compare June 19, 2018 12:16
Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall looks good; left a nit and a question

FROM %s
ENV FOO FOO
ENV BAR BAR
RUN touch /foop`, fixtures.AlpineImage)),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh good point. I took the test case from moby/moby but yeah we could add one more RUN to it 😉

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?


services:
engine:
command: ['--insecure-registry=registry:5000', '--experimental']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
@vdemeester vdemeester force-pushed the e2e-iddfile-from-moby branch from f5fabf2 to a522a78 Compare June 25, 2018 09:46
@vdemeester
Copy link
Collaborator Author

@thaJeztah updated 🎐

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@thaJeztah thaJeztah merged commit ed335ab into docker:master Jul 30, 2018
@GordonTheTurtle GordonTheTurtle added this to the 18.09.0 milestone Jul 30, 2018
@vdemeester vdemeester deleted the e2e-iddfile-from-moby branch July 30, 2018 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants