Skip to content

Commit 66a2b1b

Browse files
committed
Adjust CO e2e profile testing invocation
We recently refactored the ocp4e2e testing to support more test cases, in particular for running all node and platform rules. This means just running all go tests can have adverse side-effects if we only want to test a specific profile. This commit removes unused variables or variables that are redundant with the defaults, and adjusts the test filtering so that profile tests only run TestProfileRemediation, maintaining the older behavior of just running a single profile on a cluster to assess it's compliance posture. It also ensure jq is installed and available for the test suite to use, since some of the tests require manual remediations, and use jq to parse information from the openshift client. Remove 4.13 and 4.15 CI since those versions are no longer supported.
1 parent a780ae3 commit 66a2b1b

11 files changed

+496
-5663
lines changed

ci-operator/config/ComplianceAsCode/content/ComplianceAsCode-content-master.yaml

Lines changed: 54 additions & 79 deletions
Large diffs are not rendered by default.

ci-operator/config/ComplianceAsCode/content/ComplianceAsCode-content-master__4.12.yaml

Lines changed: 63 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ tests:
4343
set -x
4444
export PROFILE=e8
4545
export PRODUCT=rhcos4
46+
export CONTENT_DIRECTORY=$PWD
4647
export component=ocp4-content-ds
47-
export ROOT_DIR=$PWD
4848
git clone https://github.com/ComplianceAsCode/ocp4e2e.git ocp4e2e
49-
pushd ocp4e2e
50-
go test -v -timeout 120m github.com/ComplianceAsCode/ocp4e2e -profile="$PROFILE" -product="$PRODUCT" -content-image="$CONTENT_IMAGE"
49+
pushd ocp4e2e; make install-jq
50+
PATH=$PATH:/tmp/bin go test -v . -run=^TestProfileRemediations$ -profile=$PROFILE -product=$PRODUCT -content-image=ocp4-content-ds -content-directory=$CONTENT_DIRECTORY
5151
dependencies:
5252
- env: CONTENT_IMAGE
5353
name: ocp4-content-ds
@@ -68,11 +68,11 @@ tests:
6868
commands: |
6969
export PROFILE=e8
7070
export PRODUCT=ocp4
71+
export CONTENT_DIRECTORY=$PWD
7172
export component=ocp4-content-ds
72-
export ROOT_DIR=$PWD
7373
git clone https://github.com/ComplianceAsCode/ocp4e2e.git ocp4e2e
74-
pushd ocp4e2e
75-
go test -v -timeout 120m github.com/ComplianceAsCode/ocp4e2e -profile="$PROFILE" -product="$PRODUCT" -content-image="$CONTENT_IMAGE"
74+
pushd ocp4e2e; make install-jq
75+
PATH=$PATH:/tmp/bin go test -v . -run=^TestProfileRemediations$ -profile=$PROFILE -product=$PRODUCT -content-image=ocp4-content-ds -content-directory=$CONTENT_DIRECTORY
7676
dependencies:
7777
- env: CONTENT_IMAGE
7878
name: ocp4-content-ds
@@ -94,11 +94,11 @@ tests:
9494
commands: |
9595
export PROFILE=moderate
9696
export PRODUCT=ocp4
97+
export CONTENT_DIRECTORY=$PWD
9798
export component=ocp4-content-ds
98-
export ROOT_DIR=$PWD
9999
git clone https://github.com/ComplianceAsCode/ocp4e2e.git ocp4e2e
100-
pushd ocp4e2e
101-
go test -v -timeout 120m github.com/ComplianceAsCode/ocp4e2e -profile="$PROFILE" -product="$PRODUCT" -content-image="$CONTENT_IMAGE"
100+
pushd ocp4e2e; make install-jq
101+
PATH=$PATH:/tmp/bin go test -v . -run=^TestProfileRemediations$ -profile=$PROFILE -product=$PRODUCT -content-image=ocp4-content-ds -content-directory=$CONTENT_DIRECTORY
102102
dependencies:
103103
- env: CONTENT_IMAGE
104104
name: ocp4-content-ds
@@ -120,11 +120,11 @@ tests:
120120
commands: |
121121
export PROFILE=moderate-node
122122
export PRODUCT=ocp4
123+
export CONTENT_DIRECTORY=$PWD
123124
export component=ocp4-content-ds
124-
export ROOT_DIR=$PWD
125125
git clone https://github.com/ComplianceAsCode/ocp4e2e.git ocp4e2e
126-
pushd ocp4e2e
127-
go test -v -timeout 120m github.com/ComplianceAsCode/ocp4e2e -profile="$PROFILE" -product="$PRODUCT" -content-image="$CONTENT_IMAGE"
126+
pushd ocp4e2e; make install-jq
127+
PATH=$PATH:/tmp/bin go test -v . -run=^TestProfileRemediations$ -profile=$PROFILE -product=$PRODUCT -content-image=ocp4-content-ds -content-directory=$CONTENT_DIRECTORY
128128
dependencies:
129129
- env: CONTENT_IMAGE
130130
name: ocp4-content-ds
@@ -145,11 +145,11 @@ tests:
145145
commands: |
146146
export PROFILE=cis
147147
export PRODUCT=ocp4
148+
export CONTENT_DIRECTORY=$PWD
148149
export component=ocp4-content-ds
149-
export ROOT_DIR=$PWD
150150
git clone https://github.com/ComplianceAsCode/ocp4e2e.git ocp4e2e
151-
pushd ocp4e2e
152-
go test -v -timeout 120m github.com/ComplianceAsCode/ocp4e2e -profile="$PROFILE" -product="$PRODUCT" -content-image="$CONTENT_IMAGE"
151+
pushd ocp4e2e; make install-jq
152+
PATH=$PATH:/tmp/bin go test -v . -run=^TestProfileRemediations$ -profile=$PROFILE -product=$PRODUCT -content-image=ocp4-content-ds -content-directory=$CONTENT_DIRECTORY
153153
dependencies:
154154
- env: CONTENT_IMAGE
155155
name: ocp4-content-ds
@@ -170,11 +170,11 @@ tests:
170170
commands: |
171171
export PROFILE=cis-node
172172
export PRODUCT=ocp4
173+
export CONTENT_DIRECTORY=$PWD
173174
export component=ocp4-content-ds
174-
export ROOT_DIR=$PWD
175175
git clone https://github.com/ComplianceAsCode/ocp4e2e.git ocp4e2e
176-
pushd ocp4e2e
177-
go test -v -timeout 120m github.com/ComplianceAsCode/ocp4e2e -profile="$PROFILE" -product="$PRODUCT" -content-image="$CONTENT_IMAGE"
176+
pushd ocp4e2e; make install-jq
177+
PATH=$PATH:/tmp/bin go test -v . -run=^TestProfileRemediations$ -profile=$PROFILE -product=$PRODUCT -content-image=ocp4-content-ds -content-directory=$CONTENT_DIRECTORY
178178
dependencies:
179179
- env: CONTENT_IMAGE
180180
name: ocp4-content-ds
@@ -199,11 +199,11 @@ tests:
199199
commands: |
200200
export PROFILE=moderate
201201
export PRODUCT=rhcos4
202+
export CONTENT_DIRECTORY=$PWD
202203
export component=ocp4-content-ds
203-
export ROOT_DIR=$PWD
204204
git clone https://github.com/ComplianceAsCode/ocp4e2e.git ocp4e2e
205-
pushd ocp4e2e
206-
go test -v -timeout 120m github.com/ComplianceAsCode/ocp4e2e -profile="$PROFILE" -product="$PRODUCT" -content-image="$CONTENT_IMAGE"
205+
pushd ocp4e2e; make install-jq
206+
PATH=$PATH:/tmp/bin go test -v . -run=^TestProfileRemediations$ -profile=$PROFILE -product=$PRODUCT -content-image=ocp4-content-ds -content-directory=$CONTENT_DIRECTORY
207207
dependencies:
208208
- env: CONTENT_IMAGE
209209
name: ocp4-content-ds
@@ -225,11 +225,11 @@ tests:
225225
commands: |
226226
export PROFILE=stig
227227
export PRODUCT=ocp4
228+
export CONTENT_DIRECTORY=$PWD
228229
export component=ocp4-content-ds
229-
export ROOT_DIR=$PWD
230230
git clone https://github.com/ComplianceAsCode/ocp4e2e.git ocp4e2e
231-
pushd ocp4e2e
232-
go test -v -timeout 120m github.com/ComplianceAsCode/ocp4e2e -profile="$PROFILE" -product="$PRODUCT" -content-image="$CONTENT_IMAGE"
231+
pushd ocp4e2e; make install-jq
232+
PATH=$PATH:/tmp/bin go test -v . -run=^TestProfileRemediations$ -profile=$PROFILE -product=$PRODUCT -content-image=ocp4-content-ds -content-directory=$CONTENT_DIRECTORY
233233
dependencies:
234234
- env: CONTENT_IMAGE
235235
name: ocp4-content-ds
@@ -251,11 +251,11 @@ tests:
251251
commands: |
252252
export PROFILE=stig-node
253253
export PRODUCT=ocp4
254+
export CONTENT_DIRECTORY=$PWD
254255
export component=ocp4-content-ds
255-
export ROOT_DIR=$PWD
256256
git clone https://github.com/ComplianceAsCode/ocp4e2e.git ocp4e2e
257-
pushd ocp4e2e
258-
go test -v -timeout 120m github.com/ComplianceAsCode/ocp4e2e -profile="$PROFILE" -product="$PRODUCT" -content-image="$CONTENT_IMAGE"
257+
pushd ocp4e2e; make install-jq
258+
PATH=$PATH:/tmp/bin go test -v . -run=^TestProfileRemediations$ -profile=$PROFILE -product=$PRODUCT -content-image=ocp4-content-ds -content-directory=$CONTENT_DIRECTORY
259259
dependencies:
260260
- env: CONTENT_IMAGE
261261
name: ocp4-content-ds
@@ -276,11 +276,11 @@ tests:
276276
commands: |
277277
export PROFILE=pci-dss
278278
export PRODUCT=ocp4
279+
export CONTENT_DIRECTORY=$PWD
279280
export component=ocp4-content-ds
280-
export ROOT_DIR=$PWD
281281
git clone https://github.com/ComplianceAsCode/ocp4e2e.git ocp4e2e
282-
pushd ocp4e2e
283-
go test -v -timeout 120m github.com/ComplianceAsCode/ocp4e2e -profile="$PROFILE" -product="$PRODUCT" -content-image="$CONTENT_IMAGE"
282+
pushd ocp4e2e; make install-jq
283+
PATH=$PATH:/tmp/bin go test -v . -run=^TestProfileRemediations$ -profile=$PROFILE -product=$PRODUCT -content-image=ocp4-content-ds -content-directory=$CONTENT_DIRECTORY
284284
dependencies:
285285
- env: CONTENT_IMAGE
286286
name: ocp4-content-ds
@@ -301,11 +301,11 @@ tests:
301301
commands: |
302302
export PROFILE=pci-dss-node
303303
export PRODUCT=ocp4
304+
export CONTENT_DIRECTORY=$PWD
304305
export component=ocp4-content-ds
305-
export ROOT_DIR=$PWD
306306
git clone https://github.com/ComplianceAsCode/ocp4e2e.git ocp4e2e
307-
pushd ocp4e2e
308-
go test -v -timeout 120m github.com/ComplianceAsCode/ocp4e2e -profile="$PROFILE" -product="$PRODUCT" -content-image="$CONTENT_IMAGE"
307+
pushd ocp4e2e; make install-jq
308+
PATH=$PATH:/tmp/bin go test -v . -run=^TestProfileRemediations$ -profile=$PROFILE -product=$PRODUCT -content-image=ocp4-content-ds -content-directory=$CONTENT_DIRECTORY
309309
dependencies:
310310
- env: CONTENT_IMAGE
311311
name: ocp4-content-ds
@@ -326,11 +326,11 @@ tests:
326326
commands: |
327327
export PROFILE=pci-dss-4-0
328328
export PRODUCT=ocp4
329+
export CONTENT_DIRECTORY=$PWD
329330
export component=ocp4-content-ds
330-
export ROOT_DIR=$PWD
331331
git clone https://github.com/ComplianceAsCode/ocp4e2e.git ocp4e2e
332-
pushd ocp4e2e
333-
go test -v -timeout 120m github.com/ComplianceAsCode/ocp4e2e -profile="$PROFILE" -product="$PRODUCT" -content-image="$CONTENT_IMAGE"
332+
pushd ocp4e2e; make install-jq
333+
PATH=$PATH:/tmp/bin go test -v . -run=^TestProfileRemediations$ -profile=$PROFILE -product=$PRODUCT -content-image=ocp4-content-ds -content-directory=$CONTENT_DIRECTORY
334334
dependencies:
335335
- env: CONTENT_IMAGE
336336
name: ocp4-content-ds
@@ -351,11 +351,11 @@ tests:
351351
commands: |
352352
export PROFILE=pci-dss-node-4-0
353353
export PRODUCT=ocp4
354+
export CONTENT_DIRECTORY=$PWD
354355
export component=ocp4-content-ds
355-
export ROOT_DIR=$PWD
356356
git clone https://github.com/ComplianceAsCode/ocp4e2e.git ocp4e2e
357-
pushd ocp4e2e
358-
go test -v -timeout 120m github.com/ComplianceAsCode/ocp4e2e -profile="$PROFILE" -product="$PRODUCT" -content-image="$CONTENT_IMAGE"
357+
pushd ocp4e2e; make install-jq
358+
PATH=$PATH:/tmp/bin go test -v . -run=^TestProfileRemediations$ -profile=$PROFILE -product=$PRODUCT -content-image=ocp4-content-ds -content-directory=$CONTENT_DIRECTORY
359359
dependencies:
360360
- env: CONTENT_IMAGE
361361
name: ocp4-content-ds
@@ -380,11 +380,11 @@ tests:
380380
commands: |
381381
export PROFILE=high
382382
export PRODUCT=rhcos4
383+
export CONTENT_DIRECTORY=$PWD
383384
export component=ocp4-content-ds
384-
export ROOT_DIR=$PWD
385385
git clone https://github.com/ComplianceAsCode/ocp4e2e.git ocp4e2e
386-
pushd ocp4e2e
387-
go test -v -timeout 120m github.com/ComplianceAsCode/ocp4e2e -profile="$PROFILE" -product="$PRODUCT" -content-image="$CONTENT_IMAGE"
386+
pushd ocp4e2e; make install-jq
387+
PATH=$PATH:/tmp/bin go test -v . -run=^TestProfileRemediations$ -profile=$PROFILE -product=$PRODUCT -content-image=ocp4-content-ds -content-directory=$CONTENT_DIRECTORY
388388
dependencies:
389389
- env: CONTENT_IMAGE
390390
name: ocp4-content-ds
@@ -409,11 +409,11 @@ tests:
409409
commands: |
410410
export PROFILE=stig
411411
export PRODUCT=rhcos4
412+
export CONTENT_DIRECTORY=$PWD
412413
export component=ocp4-content-ds
413-
export ROOT_DIR=$PWD
414414
git clone https://github.com/ComplianceAsCode/ocp4e2e.git ocp4e2e
415-
pushd ocp4e2e
416-
go test -v -timeout 120m github.com/ComplianceAsCode/ocp4e2e -profile="$PROFILE" -product="$PRODUCT" -content-image="$CONTENT_IMAGE"
415+
pushd ocp4e2e; make install-jq
416+
PATH=$PATH:/tmp/bin go test -v . -run=^TestProfileRemediations$ -profile=$PROFILE -product=$PRODUCT -content-image=ocp4-content-ds -content-directory=$CONTENT_DIRECTORY
417417
dependencies:
418418
- env: CONTENT_IMAGE
419419
name: ocp4-content-ds
@@ -435,11 +435,11 @@ tests:
435435
commands: |
436436
export PROFILE=high
437437
export PRODUCT=ocp4
438+
export CONTENT_DIRECTORY=$PWD
438439
export component=ocp4-content-ds
439-
export ROOT_DIR=$PWD
440440
git clone https://github.com/ComplianceAsCode/ocp4e2e.git ocp4e2e
441-
pushd ocp4e2e
442-
go test -v -timeout 120m github.com/ComplianceAsCode/ocp4e2e -profile="$PROFILE" -product="$PRODUCT" -content-image="$CONTENT_IMAGE"
441+
pushd ocp4e2e; make install-jq
442+
PATH=$PATH:/tmp/bin go test -v . -run=^TestProfileRemediations$ -profile=$PROFILE -product=$PRODUCT -content-image=ocp4-content-ds -content-directory=$CONTENT_DIRECTORY
443443
dependencies:
444444
- env: CONTENT_IMAGE
445445
name: ocp4-content-ds
@@ -461,11 +461,11 @@ tests:
461461
commands: |
462462
export PROFILE=high-node
463463
export PRODUCT=ocp4
464+
export CONTENT_DIRECTORY=$PWD
464465
export component=ocp4-content-ds
465-
export ROOT_DIR=$PWD
466466
git clone https://github.com/ComplianceAsCode/ocp4e2e.git ocp4e2e
467-
pushd ocp4e2e
468-
go test -v -timeout 120m github.com/ComplianceAsCode/ocp4e2e -profile="$PROFILE" -product="$PRODUCT" -content-image="$CONTENT_IMAGE"
467+
pushd ocp4e2e; make install-jq
468+
PATH=$PATH:/tmp/bin go test -v . -run=^TestProfileRemediations$ -profile=$PROFILE -product=$PRODUCT -content-image=ocp4-content-ds -content-directory=$CONTENT_DIRECTORY
469469
dependencies:
470470
- env: CONTENT_IMAGE
471471
name: ocp4-content-ds
@@ -485,10 +485,10 @@ tests:
485485
cli: latest
486486
commands: |
487487
set -x
488-
export ROOT_DIR=$PWD
488+
export CONTENT_DIRECTORY=$PWD
489489
git clone https://github.com/ComplianceAsCode/ocp4e2e.git ocp4e2e
490-
pushd ocp4e2e
491-
make e2e-platform
490+
pushd ocp4e2e; make install-jq
491+
PATH=$PATH:/tmp/bin go test -v . -run=^TestPlatformCompliance$ -install-operator=$(INSTALL_OPERATOR) -test-type="platform" -content-directory="$(CONTENT_DIRECTORY)"
492492
from: src
493493
resources:
494494
requests:
@@ -506,10 +506,10 @@ tests:
506506
cli: latest
507507
commands: |
508508
set -x
509-
export ROOT_DIR=$PWD
509+
export CONTENT_DIRECTORY=$PWD
510510
git clone https://github.com/ComplianceAsCode/ocp4e2e.git ocp4e2e
511-
pushd ocp4e2e
512-
make e2e-node
511+
pushd ocp4e2e; make install-jq
512+
PATH=$PATH:/tmp/bin go test -v . -run=^TestNodeCompliance$ -install-operator=$(INSTALL_OPERATOR) -test-type="node" -content-directory="$(CONTENT_DIRECTORY)"
513513
from: src
514514
resources:
515515
requests:
@@ -533,10 +533,10 @@ tests:
533533
cli: latest
534534
commands: |
535535
set -x
536-
export ROOT_DIR=$PWD
536+
export CONTENT_DIRECTORY=$PWD
537537
git clone https://github.com/ComplianceAsCode/ocp4e2e.git ocp4e2e
538-
pushd ocp4e2e
539-
make e2e-platform
538+
pushd ocp4e2e; make install-jq
539+
PATH=$PATH:/tmp/bin go test -v . -run=^TestPlatformCompliance$ -install-operator=$(INSTALL_OPERATOR) -test-type="platform" -content-directory="$(CONTENT_DIRECTORY)"
540540
from: src
541541
resources:
542542
requests:
@@ -560,10 +560,10 @@ tests:
560560
cli: latest
561561
commands: |
562562
set -x
563-
export ROOT_DIR=$PWD
563+
export CONTENT_DIRECTORY=$PWD
564564
git clone https://github.com/ComplianceAsCode/ocp4e2e.git ocp4e2e
565-
pushd ocp4e2e
566-
make e2e-node
565+
pushd ocp4e2e; make install-jq
566+
PATH=$PATH:/tmp/bin go test -v . -run=^TestNodeCompliance$ -install-operator=$(INSTALL_OPERATOR) -test-type="node" -content-directory="$(CONTENT_DIRECTORY)"
567567
from: src
568568
resources:
569569
requests:

0 commit comments

Comments
 (0)