forked from konflux-ci/release-service-catalog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest-create-pyxis-image-oci-artifact.yaml
126 lines (115 loc) · 4.53 KB
/
test-create-pyxis-image-oci-artifact.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
---
apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: test-create-pyxis-image-oci-artifact
spec:
description: |
Run the create-pyxis-image task with a single oci artifact in the snapshot.
This test ensures the ORAS_ARGS are passed properly.
workspaces:
- name: tests-workspace
tasks:
- name: setup
workspaces:
- name: data
workspace: tests-workspace
taskSpec:
workspaces:
- name: data
steps:
- name: setup-values
image: quay.io/konflux-ci/release-service-utils:221d71a4f6b1a50b36b685aa20d86d7df9de33fc
script: |
#!/usr/bin/env bash
set -eux
cat > "$(workspaces.data.path)"/snapshot.json << EOF
{
"application": "myapp",
"components": [
{
"name": "comp",
"containerImage": "source@sha256:mydigest",
"repository": "registry.io/oci-artifact",
"tags": [
"testtag"
]
}
]
}
EOF
- name: run-task
taskRef:
name: create-pyxis-image
params:
- name: pyxisSecret
value: test-create-pyxis-image-cert
- name: server
value: stage
- name: snapshotPath
value: snapshot.json
workspaces:
- name: data
workspace: tests-workspace
runAfter:
- setup
- name: check-result
workspaces:
- name: data
workspace: tests-workspace
taskSpec:
workspaces:
- name: data
steps:
- name: check-result
image: quay.io/konflux-ci/release-service-utils:221d71a4f6b1a50b36b685aa20d86d7df9de33fc
script: |
#!/usr/bin/env bash
set -eux
if [ "$(wc -l < "$(workspaces.data.path)"/mock_create_container_image.txt)" != 1 ]; then
echo Error: create_container_image was expected to be called 1 time. Actual calls:
cat "$(workspaces.data.path)/mock_create_container_image.txt"
exit 1
fi
if [ -f "$(workspaces.data.path)"/mock_cleanup_tags.txt ]; then
echo Error: cleanup_tags was not expected to be called. Actual calls:
cat "$(workspaces.data.path)/mock_cleanup_tags.txt"
exit 1
fi
if ! grep -- "--tags testtag" < "$(workspaces.data.path)"/mock_create_container_image.txt 2> /dev/null
then
echo Error: create_container_image call was expected to include "--tags testtag". Actual call:
cat "$(workspaces.data.path)/mock_create_container_image.txt"
exit 1
fi
if ! grep -- "--rh-push false" < "$(workspaces.data.path)"/mock_create_container_image.txt 2> /dev/null
then
echo Error: create_container_image call was expected to include "--rh-push false". Actual call:
cat "$(workspaces.data.path)/mock_create_container_image.txt"
exit 1
fi
if [ "$(wc -l < "$(workspaces.data.path)"/mock_skopeo.txt)" != 1 ]; then
echo Error: skopeo was expected to be called 1 time. Actual calls:
cat "$(workspaces.data.path)/mock_skopeo.txt"
exit 1
fi
if [ "$(wc -l < "$(workspaces.data.path)"/mock_oras.txt)" != 3 ]; then
echo Error: oras was expected to be called 3 times. Actual calls:
cat "$(workspaces.data.path)/mock_oras.txt"
exit 1
fi
if ! grep -- "--platform linux/amd64" < "$(workspaces.data.path)"/mock_oras.txt 2> /dev/null
then
echo Error: oras call was expected to include "--platform linux/amd64". Actual call:
cat "$(workspaces.data.path)/mock_oras.txt"
exit 1
fi
[ "$(head -n 1 < "$(workspaces.data.path)"/mock_skopeo.txt)" \
= "inspect --raw docker://registry.io/oci-artifact@sha256:mydigest" ]
if [ "$(wc -l < "$(workspaces.data.path)"/mock_select-oci-auth.txt)" != 2 ]; then
echo Error: select-oci-with was expected to be called 2 times. Actual calls:
cat "$(workspaces.data.path)/mock_select-oci-auth.txt"
exit 1
fi
runAfter:
- run-task