mirror of
https://github.com/GoogleContainerTools/kaniko
synced 2026-10-21 12:54:35 +02:00
Integration test refactoring (#126)
* integration test refactoring * config file cleanup * more test refactoring * remove debug file * moving around more files * fixing up integration tests * integration tests work * some housekeeping * fixing tests * addressing comments * debugging * debugging * actual debugging * skip integration tests for travis * install container-diff before integration tests * syntax * make test failures less noisy * fixing tests * hopefully fixing CI? * fixes * more fixes * let's actually fix CI * more testing * testing * proper auth * typos * adding support for args in integration tests * formatting * formatting * adding support for testing bucket context * adding bucket test dockerfile * addressing comments * syntax
This commit is contained in:
@@ -1,6 +0,0 @@
|
||||
FROM gcr.io/google-appengine/debian9:latest
|
||||
ENV dir /tmp/dir/
|
||||
ONBUILD RUN echo "onbuild" > /tmp/onbuild
|
||||
ONBUILD RUN mkdir $dir
|
||||
ONBUILD RUN echo "onbuild 2" > ${dir}/onbuild2
|
||||
ONBUILD WORKDIR /new/workdir
|
||||
@@ -1,22 +0,0 @@
|
||||
FROM gcr.io/google-appengine/debian9:latest
|
||||
# First, try adding some regular files
|
||||
ADD context/foo foo
|
||||
ADD context/foo /foodir/
|
||||
ADD context/bar/b* bar/
|
||||
ADD . newdir
|
||||
ADD ["context/foo", "/tmp/foo" ]
|
||||
|
||||
# Next, make sure environment replacement works
|
||||
ENV contextenv ./context
|
||||
ADD $contextenv/* /tmp/${contextenv}/
|
||||
|
||||
# Now, test extracting local tar archives
|
||||
ADD context/tars/fil* /tars/
|
||||
ADD context/tars/file.tar /tars_again
|
||||
|
||||
# Test with ARG
|
||||
ARG file
|
||||
COPY $file /arg
|
||||
|
||||
# Finally, test adding a remote URL, concurrently with a normal file
|
||||
ADD https://github.com/GoogleCloudPlatform/docker-credential-gcr/releases/download/v1.4.3/docker-credential-gcr_linux_386-1.4.3.tar.gz context/foo /test/all/
|
||||
@@ -1,20 +0,0 @@
|
||||
FROM alpine:3.7
|
||||
COPY context/foo foo
|
||||
COPY context/foo /foodir/
|
||||
COPY context/bar/b* bar/
|
||||
COPY context/fo? /foo2
|
||||
COPY context/bar/doesnotexist* context/foo hello
|
||||
COPY ./context/empty /empty
|
||||
COPY ./ dir/
|
||||
COPY . newdir
|
||||
COPY context/bar /baz/
|
||||
COPY ["context/foo", "/tmp/foo" ]
|
||||
COPY context/b* /baz/
|
||||
COPY context/foo context/bar/ba? /test/
|
||||
COPY context/arr[[]0].txt /mydir/
|
||||
COPY context/bar/bat .
|
||||
|
||||
ENV contextenv ./context
|
||||
COPY ${contextenv}/foo /tmp/foo2
|
||||
COPY $contextenv/foo /tmp/foo3
|
||||
COPY $contextenv/* /tmp/${contextenv}/
|
||||
@@ -1,19 +0,0 @@
|
||||
FROM gcr.io/google-appengine/debian9
|
||||
ENV hey hey
|
||||
ENV PATH /usr/local
|
||||
ENV hey hello
|
||||
ENV first=foo second=foo2
|
||||
ENV third $second:/third
|
||||
ENV myName="John Doe" myDog=Rex\ The\ Dog \
|
||||
myCat=fluffy
|
||||
ENV PATH something
|
||||
ENV test=value\ value2
|
||||
ENV test1="a'b'c"
|
||||
ENV test2='a"b"c'
|
||||
ENV test3=a\ b name2=b\ c
|
||||
ENV test4="a\"b"
|
||||
ENV test5='a\"b'
|
||||
ENV test6="a\'b"
|
||||
ENV atomic=one
|
||||
ENV atomic=two newatomic=$atomic
|
||||
ENV newenv=$doesntexist/newenv
|
||||
@@ -1,15 +0,0 @@
|
||||
# Copyright 2018 Google, Inc. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
FROM gcr.io/google-appengine/debian9:latest
|
||||
@@ -1,7 +0,0 @@
|
||||
FROM gcr.io/distroless/base:latest
|
||||
CMD ["command", "one"]
|
||||
CMD ["command", "two"]
|
||||
CMD echo "hello"
|
||||
|
||||
ENTRYPOINT ["execute", "something"]
|
||||
ENTRYPOINT ["execute", "entrypoint"]
|
||||
@@ -1,3 +0,0 @@
|
||||
FROM busybox
|
||||
ADD context/tars /tmp/tars
|
||||
RUN mv /tmp/tars /foo
|
||||
@@ -1,7 +0,0 @@
|
||||
FROM gcr.io/kaniko-test/onbuild-base:latest
|
||||
COPY context/foo foo
|
||||
ENV dir /new/workdir/
|
||||
ARG file
|
||||
ONBUILD RUN echo "onbuild" > $file
|
||||
ONBUILD RUN echo "onbuild 2" > ${dir}
|
||||
ONBUILD WORKDIR /new/workdir
|
||||
@@ -1,2 +0,0 @@
|
||||
FROM busybox
|
||||
RUN echo "hey" > /hey
|
||||
@@ -1,23 +0,0 @@
|
||||
# Copyright 2018 Google, Inc. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
FROM gcr.io/google-appengine/debian9
|
||||
RUN echo "hey" > /etc/foo
|
||||
RUN echo "baz" > /etc/baz
|
||||
RUN cp /etc/baz /etc/bar
|
||||
RUN rm /etc/baz
|
||||
|
||||
# Test with ARG
|
||||
ARG file
|
||||
RUN echo "run" > $file
|
||||
@@ -1,20 +0,0 @@
|
||||
# Copyright 2018 Google, Inc. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# Test to make sure the executor builds an image correctly
|
||||
# when no files are changed
|
||||
|
||||
FROM gcr.io/google-appengine/debian9
|
||||
RUN echo "hey"
|
||||
MAINTAINER kaniko
|
||||
@@ -1,14 +0,0 @@
|
||||
FROM scratch
|
||||
# First, make sure simple arg replacement works
|
||||
ARG file
|
||||
COPY $file /foo
|
||||
# Check that setting a default value works
|
||||
ARG file2=context/bar/bat
|
||||
COPY $file2 /bat
|
||||
# Check that overriding a default value works
|
||||
ARG file3=context/bar/baz
|
||||
COPY $file3 /baz
|
||||
# Check that setting an ENV will override the ARG
|
||||
ENV file context/bar/bam/bat
|
||||
COPY $file /env
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
# Copyright 2018 Google, Inc. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
FROM gcr.io/google-appengine/debian9
|
||||
RUN useradd testuser
|
||||
RUN groupadd testgroup
|
||||
USER testuser:testgroup
|
||||
RUN echo "hey" > /tmp/foo
|
||||
@@ -1,7 +0,0 @@
|
||||
FROM gcr.io/google-appengine/debian9
|
||||
RUN mkdir /foo
|
||||
RUN echo "hello" > /foo/hey
|
||||
VOLUME /foo/bar /tmp
|
||||
ENV VOL /baz/bat
|
||||
VOLUME ["${VOL}"]
|
||||
RUN echo "hello again" > /tmp/hey
|
||||
@@ -1,17 +0,0 @@
|
||||
FROM gcr.io/google-appengine/debian9@sha256:6b3aa04751aa2ac3b0c7be4ee71148b66d693ad212ce6d3244bd2a2a147f314a
|
||||
COPY context/foo foo
|
||||
WORKDIR /test
|
||||
# Test that this will be appended on to the previous command, to create /test/workdir
|
||||
WORKDIR workdir
|
||||
COPY context/foo ./currentfoo
|
||||
# Test that the RUN command will happen in the correct directory
|
||||
RUN cp currentfoo newfoo
|
||||
WORKDIR /new/dir
|
||||
ENV dir /another/new/dir
|
||||
WORKDIR $dir/newdir
|
||||
WORKDIR $dir/$doesntexist
|
||||
WORKDIR /
|
||||
|
||||
# Test with ARG
|
||||
ARG workdir
|
||||
WORKDIR $workdir
|
||||
@@ -1,12 +0,0 @@
|
||||
[
|
||||
{
|
||||
"Image1": "gcr.io/kaniko-test/docker-test-add:latest",
|
||||
"Image2": "gcr.io/kaniko-test/kaniko-test-add:latest",
|
||||
"DiffType": "File",
|
||||
"Diff": {
|
||||
"Adds": null,
|
||||
"Dels": null,
|
||||
"Mods": null
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -1,12 +0,0 @@
|
||||
[
|
||||
{
|
||||
"Image1": "gcr.io/kaniko-test/docker-test-bucket-buildcontext:latest",
|
||||
"Image2": "gcr.io/kaniko-test/kaniko-test-bucket-buildcontext:latest",
|
||||
"DiffType": "File",
|
||||
"Diff": {
|
||||
"Adds": null,
|
||||
"Dels": null,
|
||||
"Mods": null
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -1,12 +0,0 @@
|
||||
[
|
||||
{
|
||||
"Image1": "gcr.io/kaniko-test/docker-test-copy:latest",
|
||||
"Image2": "gcr.io/kaniko-test/kaniko-test-copy:latest",
|
||||
"DiffType": "File",
|
||||
"Diff": {
|
||||
"Adds": null,
|
||||
"Dels": null,
|
||||
"Mods": null
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -1,12 +0,0 @@
|
||||
[
|
||||
{
|
||||
"Image1": "gcr.io/kaniko-test/docker-extract-filesystem:latest",
|
||||
"Image2": "gcr.io/kaniko-test/kaniko-extract-filesystem:latest",
|
||||
"DiffType": "File",
|
||||
"Diff": {
|
||||
"Adds": null,
|
||||
"Dels": null,
|
||||
"Mods": null
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -1,12 +0,0 @@
|
||||
[
|
||||
{
|
||||
"Image1": "gcr.io/kaniko-test/docker-test-mv-add:latest",
|
||||
"Image2": "gcr.io/kaniko-test/kaniko-test-mv-add:latest",
|
||||
"DiffType": "File",
|
||||
"Diff": {
|
||||
"Adds": null,
|
||||
"Dels": null,
|
||||
"Mods": null
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -1,12 +0,0 @@
|
||||
[
|
||||
{
|
||||
"Image1": "gcr.io/kaniko-test/docker-test-onbuild:latest",
|
||||
"Image2": "gcr.io/kaniko-test/kaniko-test-onbuild:latest",
|
||||
"DiffType": "File",
|
||||
"Diff": {
|
||||
"Adds": null,
|
||||
"Dels": null,
|
||||
"Mods": null
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -1,12 +0,0 @@
|
||||
[
|
||||
{
|
||||
"Image1": "gcr.io/kaniko-test/docker-test-registry:latest",
|
||||
"Image2": "gcr.io/kaniko-test/kaniko-test-registry:latest",
|
||||
"DiffType": "File",
|
||||
"Diff": {
|
||||
"Adds": null,
|
||||
"Dels": null,
|
||||
"Mods": null
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -1,12 +0,0 @@
|
||||
[
|
||||
{
|
||||
"Image1": "gcr.io/kaniko-test/docker-test-run:latest",
|
||||
"Image2": "gcr.io/kaniko-test/kaniko-test-run:latest",
|
||||
"DiffType": "File",
|
||||
"Diff": {
|
||||
"Adds": null,
|
||||
"Dels": null,
|
||||
"Mods": null
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -1,12 +0,0 @@
|
||||
[
|
||||
{
|
||||
"Image1": "gcr.io/kaniko-test/docker-test-run-2:latest",
|
||||
"Image2": "gcr.io/kaniko-test/kaniko-test-run-2:latest",
|
||||
"DiffType": "File",
|
||||
"Diff": {
|
||||
"Adds": null,
|
||||
"Dels": null,
|
||||
"Mods": null
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -1,12 +0,0 @@
|
||||
[
|
||||
{
|
||||
"Image1": "gcr.io/kaniko-test/docker-test-scratch:latest",
|
||||
"Image2": "gcr.io/kaniko-test/kaniko-test-scratch:latest",
|
||||
"DiffType": "File",
|
||||
"Diff": {
|
||||
"Adds": null,
|
||||
"Dels": null,
|
||||
"Mods": null
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -1,12 +0,0 @@
|
||||
[
|
||||
{
|
||||
"Image1": "gcr.io/kaniko-test/docker-test-volume:latest",
|
||||
"Image2": "gcr.io/kaniko-test/kaniko-test-volume:latest",
|
||||
"DiffType": "File",
|
||||
"Diff": {
|
||||
"Adds": null,
|
||||
"Dels": null,
|
||||
"Mods": null
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -1,12 +0,0 @@
|
||||
[
|
||||
{
|
||||
"Image1": "gcr.io/kaniko-test/docker-test-workdir:latest",
|
||||
"Image2": "gcr.io/kaniko-test/kaniko-test-workdir:latest",
|
||||
"DiffType": "File",
|
||||
"Diff": {
|
||||
"Adds": null,
|
||||
"Dels": null,
|
||||
"Mods": null
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -1,41 +0,0 @@
|
||||
schemaVersion: '2.0.0'
|
||||
metadataTest:
|
||||
env:
|
||||
- key: hey
|
||||
value: hello
|
||||
- key: PATH
|
||||
value: something
|
||||
- key: first
|
||||
value: foo
|
||||
- key: second
|
||||
value: foo2
|
||||
- key: third
|
||||
value: foo2:/third
|
||||
- key: myName
|
||||
value: John Doe
|
||||
- key: myDog
|
||||
value: Rex The Dog
|
||||
- key: myCat
|
||||
value: fluffy
|
||||
- key: test
|
||||
value: value value2
|
||||
- key: test1
|
||||
value: a'b'c
|
||||
- key: test2
|
||||
value: a"b"c
|
||||
- key: test3
|
||||
value: a b
|
||||
- key: name2
|
||||
value: b c
|
||||
- key: test4
|
||||
value: a"b
|
||||
- key: test5
|
||||
value: a\"b
|
||||
- key: test6
|
||||
value: a\'b
|
||||
- key: atomic
|
||||
value: two
|
||||
- key: newatomic
|
||||
value: one
|
||||
- key: newenv
|
||||
value: /newenv
|
||||
@@ -1,4 +0,0 @@
|
||||
schemaVersion: '2.0.0'
|
||||
metadataTest:
|
||||
cmd: ["/bin/sh", "-c", "echo \"hello\""]
|
||||
entrypoint: ["execute", "entrypoint"]
|
||||
@@ -1,15 +0,0 @@
|
||||
schemaVersion: '2.0.0'
|
||||
commandTests:
|
||||
- name: 'whoami'
|
||||
command: 'whoami'
|
||||
expectedOutput: ['testuser']
|
||||
excludedOutput: ['root']
|
||||
- name: 'file owner'
|
||||
command: 'ls'
|
||||
args: ['-l', '/tmp/foo']
|
||||
expectedOutput: ['.*testuser.*', '.*testgroup.*']
|
||||
excludedOutput: ['.*root.*']
|
||||
fileContentTests:
|
||||
- name: "/tmp/foo"
|
||||
path: "/tmp/foo"
|
||||
expectedContent: ["hey"]
|
||||
Reference in New Issue
Block a user