Skip to content
This repository was archived by the owner on Jan 25, 2023. It is now read-only.

Commit 5f4e2c7

Browse files
author
Lukas Holzer
authored
tests: add container structure tests (#804)
* tests: add container structure tests * chore: updates * chore: replace bats tests with container structure tests
1 parent 0e2f4c5 commit 5f4e2c7

File tree

5 files changed

+84
-46
lines changed

5 files changed

+84
-46
lines changed

.circleci/config.yml

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,31 @@ jobs:
179179
- save-images:
180180
images: "${SHA1_IMAGE_URL} ${GIT_TAG_IMAGE_URL} ${BRANCH_IMAGE_URL} ${SHA1_IMAGE_URL}-test ${BRANCH_IMAGE_URL}-test"
181181

182+
container-structure-tests:
183+
parameters:
184+
container-image:
185+
type: string
186+
machine:
187+
image: ubuntu-2004:202111-02
188+
resource_class: xlarge
189+
steps:
190+
- checkout
191+
- setup-remote-docker-with-experimental-feats
192+
# Load the previously saved docker images from the CCI workspace
193+
- load-images
194+
# Compute the env vars with the resulting docker tags and docker image names
195+
- compute-docker-tags:
196+
image-name: << parameters.container-image >>
197+
- run:
198+
name: Install Google Container Structure Test
199+
command: curl -LO https://storage.googleapis.com/container-structure-test/latest/container-structure-test-linux-amd64 && chmod +x container-structure-test-linux-amd64 && mkdir -p $HOME/bin && export PATH=$PATH:$HOME/bin && mv container-structure-test-linux-amd64 $HOME/bin/container-structure-test
200+
- run:
201+
name: Run Tests
202+
command: |
203+
container-structure-test test --image ${SHA1_IMAGE_URL} --config focal.yaml --test-report container-structure.xml --output junit
204+
- store_test_results:
205+
path: ./container-structure.xml
206+
182207
run-tests:
183208
parameters:
184209
container-image:
@@ -301,6 +326,9 @@ workflows:
301326
- run-tests:
302327
container-image: "netlify/build"
303328
requires: [build-and-push-images, build-images-for-forks, lint]
329+
- container-structure-tests:
330+
container-image: "netlify/build"
331+
requires: [build-and-push-images, build-images-for-forks, lint]
304332
# A scheduled daily build and test run to detect issues early instead of during a release or fix
305333
daily-test:
306334
triggers: # Use the triggers key to indicate a scheduled build
@@ -320,4 +348,3 @@ workflows:
320348
- run-tests:
321349
container-image: "netlify/build"
322350
requires: [build-and-push-images]
323-

focal.yaml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
schemaVersion: "2.0.0"
2+
3+
metadataTest:
4+
entrypoint: []
5+
cmd: ["bash"]
6+
workdir: "/"
7+
user: "buildbot"
8+
env:
9+
- key: TARGETARCH
10+
value: amd64
11+
- key: NF_IMAGE_NAME
12+
value: focal
13+
- key: NF_IMAGE_TAG
14+
value: "^.+" # checks if it is set
15+
isRegex: true
16+
- key: NF_IMAGE_VERSION
17+
value: "^.+" # checks if it is set
18+
isRegex: true
19+
- key: LANGUAGE
20+
value: "en_US:en"
21+
- key: LANG
22+
value: "en_US.UTF-8"
23+
- key: LC_ALL
24+
value: "en_US.UTF-8"
25+
labels:
26+
- key: maintainer
27+
value: Netlify
28+
29+
fileExistenceTests:
30+
- name: "Home directory"
31+
path: "/opt/buildhome/"
32+
shouldExist: true
33+
permissions: "drwxr-xr-x"
34+
uid: 2500 # buildbot
35+
gid: 2500 # buildbot
36+
37+
commandTests:
38+
- name: "zstd compression library"
39+
command: "zstd"
40+
args: ["--version"]
41+
expectedOutput: ["zstd command line interface 64-bits v1.4.8"]
42+
43+
- name: "wkhtmltopdf"
44+
command: "wkhtmltopdf"
45+
args: ["-V"]
46+
expectedOutput: ["wkhtmltopdf 0.12.6"]
47+
48+
- name: "vips is installed and CLI tools are available"
49+
command: "vips"
50+
args: ["-v"]
51+
expectedOutput: ["vips-8.9.1-Sun"]
52+
53+
- name: "DOTNet version 6.0 is installed and available at startup"
54+
command: "dotnet"
55+
args: ["--version"]
56+
expectedOutput: ["6.0"]

tests/base.bats

Lines changed: 0 additions & 23 deletions
This file was deleted.

tests/dotnet/base.bats

Lines changed: 0 additions & 11 deletions
This file was deleted.

tests/vips/base.bats

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)