Skip to content

Commit

Permalink
Merge pull request #5077 from werf/test-e2e-extend-complex-build-test
Browse files Browse the repository at this point in the history
test(e2e): extend complex build test
  • Loading branch information
ilya-lesikov committed Nov 1, 2022
2 parents ddc09e4 + 3fe89b9 commit 2fdab3b
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 9 deletions.
4 changes: 4 additions & 0 deletions test/e2e/build/_fixtures/complex/state0/Dockerfile
Expand Up @@ -10,6 +10,7 @@ FROM ubuntu:22.04 AS result
ARG CHANGED_ARG="should_be_changed"
ENV COMPOSED_ENV="env-${CHANGED_ARG}"
LABEL COMPOSED_LABEL="label-${CHANGED_ARG}"
MAINTAINER "maintainer"

SHELL ["/bin/sh", "-c"]
USER 0:0
Expand All @@ -20,6 +21,9 @@ COPY --from=builder /helloworld.tgz /helloworld.tgz

RUN touch /created-by-run-state0
RUN mkdir -p /volume10/should-exist-in-volume
RUN --mount=type=tmpfs,target=/tmpfs touch /tmpfs/created-by-run-state0
RUN --mount=type=bind,target=/bind,rw touch /bind/created-by-run-state0
RUN --mount=type=bind,from=builder,target=/bind-from-builder,rw touch /bind-from-builder/created-by-run-state0

ENTRYPOINT ["sh", "-ec"]
CMD ["tail -f /dev/null"]
Expand Down
4 changes: 4 additions & 0 deletions test/e2e/build/_fixtures/complex/state1/Dockerfile
Expand Up @@ -9,6 +9,7 @@ FROM ubuntu:22.04 AS result
ARG CHANGED_ARG="should_be_changed"
ENV COMPOSED_ENV="env-${CHANGED_ARG}"
LABEL COMPOSED_LABEL="label-${CHANGED_ARG}"
MAINTAINER "maintainer-${CHANGED_ARG}"

SHELL ["/bin/sh", "-c"]
USER 0:0
Expand All @@ -17,6 +18,9 @@ WORKDIR /
COPY --from=builder /app /app

RUN touch /created-by-run-state1
RUN --mount=type=tmpfs,target=/tmpfs touch /tmpfs/created-by-run-state1
RUN --mount=type=bind,target=/bind,rw touch /bind/created-by-run-state1
RUN --mount=type=bind,from=builder,target=/bind-from-builder,rw touch /bind-from-builder/created-by-run-state1

ENTRYPOINT ["sh", "-ec"]
CMD ["tail -f /dev/null"]
Expand Down
30 changes: 21 additions & 9 deletions test/e2e/build/complex_test.go
Expand Up @@ -102,6 +102,12 @@ var _ = Describe("Complex build", Label("e2e", "build", "complex"), func() {
"test -f /created-by-run-state0",

"test -d /volume10/should-exist-in-volume",

"! test -e /tmpfs",

"! test -e /bind",

"! test -e /bind-from-builder",
)

By(`state0: checking "stapel-shell" image content`)
Expand All @@ -119,15 +125,15 @@ var _ = Describe("Complex build", Label("e2e", "build", "complex"), func() {
"stat -c %u:%g /app/static/style.css | diff <(echo 1050:1051) -",
"grep -qF 'text-align: center;' /app/static/style.css",

"! test -f /app/app.go",
"! test -e /app/app.go",

"! test -f /app/static/script.js",
"! test -e /app/static/script.js",

"test -f /triggered-stages",
"stat -c %u:%g /triggered-stages | diff <(echo 0:0) -",
"echo 'beforeInstall\ninstall\nbeforeSetup\nsetup' | diff /triggered-stages -",

"! test -f /tmp_dir/file",
"! test -e /tmp_dir/file",

"test -f /basedir/file",
"stat -c %u:%g /basedir/file | diff <(echo 0:0) -",
Expand Down Expand Up @@ -176,22 +182,28 @@ var _ = Describe("Complex build", Label("e2e", "build", "complex"), func() {
"test -f /app/added/file1",
"echo 'file1content-state1' | diff /app/added/file1 -",

"! test -f /app/added/file2",
"! test -e /app/added/file2",

"test -f /app/added/file3",
"echo 'file3content-state1' | diff /app/added/file3 -",

"test -f /app/copied/file1",
"echo 'file1content-state1' | diff /app/copied/file1 -",

"! test -f /app/copied/file2",
"! test -e /app/copied/file2",

"test -f /app/copied/file3",
"echo 'file3content-state1' | diff /app/copied/file3 -",

"! test -f /helloworld.tgz",
"! test -e /helloworld.tgz",

"test -f /created-by-run-state1",

"! test -e /tmpfs",

"! test -e /bind",

"! test -e /bind-from-builder",
)

By(`state1: checking "stapel-shell" image content`)
Expand All @@ -205,19 +217,19 @@ var _ = Describe("Complex build", Label("e2e", "build", "complex"), func() {
"stat -c %u:%g /app/static/index.html | diff <(echo 1050:1051) -",
"grep -qF '<title>Hello, world</title>' /app/static/index.html",

"! test -f /app/static/style.css",
"! test -e /app/static/style.css",

"test -f /app/app.go",
"stat -c %u:%g /app/app.go | diff <(echo 1050:1051) -",
"grep -qF 'package hello' /app/app.go",

"! test -f /app/static/script.js",
"! test -e /app/static/script.js",

"test -f /triggered-stages",
"stat -c %u:%g /triggered-stages | diff <(echo 0:0) -",
"echo 'beforeInstall\ninstall\nbeforeSetup\nsetup' | diff /triggered-stages -",

"! test -f /tmp_dir/file",
"! test -e /tmp_dir/file",

"test -f /basedir/file",
"stat -c %u:%g /basedir/file | diff <(echo 0:0) -",
Expand Down

0 comments on commit 2fdab3b

Please sign in to comment.