Skip to content

Commit

Permalink
tests: Remove use of CentOS 8 from func tests
Browse files Browse the repository at this point in the history
The source of this image stream is also changed to the smaller and more
up to date containerdisks project version of the image.

Conflicts:
  tests/func-tests/golden_image_test.go
  hack/check_golden_images.sh

NOTE: The conflict is due to commit 2e339b9 missing in release-1.8.

Signed-off-by: Lee Yarwood <[email protected]>
Co-authored-by: Felix Matouschek <[email protected]>
  • Loading branch information
lyarwood and 0xFelix committed Aug 26, 2024
1 parent b0eba17 commit a026fce
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion build/Dockerfile.okd
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ COPY hack/testFiles/test_quickstart.yaml quickStart/
COPY hack/testFiles/test_dashboard_cm.yaml dashboard/
COPY assets/ .
COPY ci-test-files/dataImportCronTemplatesWithImageStream.yaml dataImportCronTemplates/
COPY ci-test-files/centos8-imagestream.yaml imageStreams/
COPY ci-test-files/centos9-stream-imagestream.yaml imageStreams/

ENTRYPOINT /usr/bin/hyperconverged-cluster-operator
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: image.openshift.io/v1
kind: ImageStream
metadata:
name: centos8
name: centos-stream9
namespace: kubevirt-os-images
spec:
lookupPolicy:
Expand All @@ -10,7 +10,7 @@ spec:
- annotations: null
from:
kind: DockerImage
name: quay.io/kubevirt/centos8-container-disk-images
name: quay.io/containerdisks/centos-stream:9
importPolicy:
scheduled: true
name: latest
6 changes: 3 additions & 3 deletions ci-test-files/dataImportCronTemplatesWithImageStream.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
- metadata:
name: centos8-image-cron-is
name: centos-stream9-image-cron-is
spec:
schedule: "0 */12 * * *"
template:
spec:
source:
registry:
imageStream: "centos8"
imageStream: "centos-stream9"
pullMethod: node
storage:
resources:
requests:
storage: 10Gi
garbageCollect: Outdated
managedDataSource: centos8-is
managedDataSource: centos-stream9-is
20 changes: 10 additions & 10 deletions hack/check_golden_images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,45 +13,45 @@ export -f count_data_import_crons
if [[ $(${KUBECTL_BINARY} get ssp -n ${INSTALLED_NAMESPACE}) ]]; then

# test image streams
[[ $(${KUBECTL_BINARY} get imageStream centos8 -n ${IMAGES_NS} --no-headers | wc -l) -eq 1 ]]
[[ "$(${KUBECTL_BINARY} get imageStream centos8 -n ${IMAGES_NS} -o json | jq -cM '.spec.tags[0].from')" == '{"kind":"DockerImage","name":"quay.io/kubevirt/centos8-container-disk-images"}' ]]
[[ $(${KUBECTL_BINARY} get imageStream centos-stream9 -n ${IMAGES_NS} --no-headers | wc -l) -eq 1 ]]
[[ "$(${KUBECTL_BINARY} get imageStream centos-stream9 -n ${IMAGES_NS} -o json | jq -cM '.spec.tags[0].from')" == '{"kind":"DockerImage","name":"quay.io/containerdisks/centos-stream:9"}' ]]

# check that HCO reconciles the image stream
./hack/retry.sh 10 3 "${KUBECTL_BINARY} patch imageStream -n ${IMAGES_NS} centos8 --type=json -p '[{\"op\": \"add\", \"path\": \"/metadata/labels/test-label\", \"value\": \"test\"}]'"
./hack/retry.sh 10 3 "${KUBECTL_BINARY} patch imageStream -n ${IMAGES_NS} centos-stream9 --type=json -p '[{\"op\": \"add\", \"path\": \"/metadata/labels/test-label\", \"value\": \"test\"}]'"
sleep 10
# HCO expect to remove the test-label label from the image stream
./hack/retry.sh 10 3 "[[ -z '$(${KUBECTL_BINARY} get imageStream -n ${IMAGES_NS} centos8 -o jsonpath='{.metadata.labels.test-label}')' ]]" "${KUBECTL_BINARY} get imageStream -n ${IMAGES_NS} centos8 -o yaml"
./hack/retry.sh 10 3 "[[ -z '$(${KUBECTL_BINARY} get imageStream -n ${IMAGES_NS} centos-stream9 -o jsonpath='{.metadata.labels.test-label}')' ]]" "${KUBECTL_BINARY} get imageStream -n ${IMAGES_NS} centos-stream9 -o yaml"

${KUBECTL_BINARY} get hco -n "${INSTALLED_NAMESPACE}" kubevirt-hyperconverged -o jsonpath='{.spec.featureGates.enableCommonBootImageImport}'
${KUBECTL_BINARY} get ssp -n "${INSTALLED_NAMESPACE}" ssp-kubevirt-hyperconverged -o jsonpath='{.spec.commonTemplates.dataImportCronTemplates}' | jq -e '.[] |select(.metadata.name=="centos-stream9-image-cron")'
${KUBECTL_BINARY} get ssp -n "${INSTALLED_NAMESPACE}" ssp-kubevirt-hyperconverged -o jsonpath='{.spec.commonTemplates.dataImportCronTemplates}' | jq -e '.[] |select(.metadata.name=="fedora-image-cron")'
${KUBECTL_BINARY} get ssp -n "${INSTALLED_NAMESPACE}" ssp-kubevirt-hyperconverged -o jsonpath='{.spec.commonTemplates.dataImportCronTemplates}' | jq -e '.[] |select(.metadata.name=="centos8-image-cron-is")'
${KUBECTL_BINARY} get ssp -n "${INSTALLED_NAMESPACE}" ssp-kubevirt-hyperconverged -o jsonpath='{.spec.commonTemplates.dataImportCronTemplates}' | jq -e '.[] |select(.metadata.name=="centos-stream9-image-cron-is")'

./hack/retry.sh 10 30 "[[ \$(count_data_import_crons) -eq 3 ]]" "${KUBECTL_BINARY} get DataImportCron -A"

${KUBECTL_BINARY} get DataImportCron -n ${IMAGES_NS}

${KUBECTL_BINARY} get DataImportCron -o yaml -n ${IMAGES_NS} centos-stream9-image-cron
${KUBECTL_BINARY} get DataImportCron -o yaml -n ${IMAGES_NS} fedora-image-cron
${KUBECTL_BINARY} get DataImportCron -o yaml -n ${IMAGES_NS} centos8-image-cron-is || true
${KUBECTL_BINARY} get DataImportCron -o yaml -n ${IMAGES_NS} centos-stream9-image-cron-is || true

[[ $(${KUBECTL_BINARY} get DataImportCron -o json -n ${IMAGES_NS} centos8-image-cron-is | jq -cM '.spec.template.spec.source.registry') == '{"imageStream":"centos8","pullMethod":"node"}' ]]
[[ $(${KUBECTL_BINARY} get DataImportCron -o json -n ${IMAGES_NS} centos-stream9-image-cron-is | jq -cM '.spec.template.spec.source.registry') == '{"imageStream":"centos-stream9","pullMethod":"node"}' ]]

# disable the feature
./hack/retry.sh 10 3 "${KUBECTL_BINARY} patch hco -n \"${INSTALLED_NAMESPACE}\" --type=json kubevirt-hyperconverged -p '[{ \"op\": \"replace\", \"path\": \"/spec/featureGates/enableCommonBootImageImport\", \"value\": false }]'"
sleep 10

# check that the image streams and the DataImportCron were removed
./hack/retry.sh 10 3 "[[ $(${KUBECTL_BINARY} get imageStream centos8 -n ${IMAGES_NS} --no-headers | wc -l) -eq 0 ]]"
./hack/retry.sh 10 3 "[[ $(${KUBECTL_BINARY} get imageStream centos-stream9 -n ${IMAGES_NS} --no-headers | wc -l) -eq 0 ]]"
./hack/retry.sh 10 3 "[[ $(${KUBECTL_BINARY} get DataImportCron -A --no-headers | wc -l) -eq 0 ]]"

# enable it back
./hack/retry.sh 10 3 "${KUBECTL_BINARY} patch hco -n \"${INSTALLED_NAMESPACE}\" --type=json kubevirt-hyperconverged -p '[{ \"op\": \"replace\", \"path\": \"/spec/featureGates/enableCommonBootImageImport\", \"value\": true }]'"
sleep 10

# test image streams
[[ $(${KUBECTL_BINARY} get imageStream centos8 -n ${IMAGES_NS} --no-headers | wc -l) -eq 1 ]]
[[ "$(${KUBECTL_BINARY} get imageStream centos8 -n ${IMAGES_NS} -o json | jq -cM '.spec.tags[0].from')" == '{"kind":"DockerImage","name":"quay.io/kubevirt/centos8-container-disk-images"}' ]]
[[ $(${KUBECTL_BINARY} get imageStream centos-stream9 -n ${IMAGES_NS} --no-headers | wc -l) -eq 1 ]]
[[ "$(${KUBECTL_BINARY} get imageStream centos-stream9 -n ${IMAGES_NS} -o json | jq -cM '.spec.tags[0].from')" == '{"kind":"DockerImage","name":"quay.io/containerdisks/centos-stream:9"}' ]]

# make sure all the DataImportCrons are back
./hack/retry.sh 10 30 "[[ \$(count_data_import_crons) -eq 3 ]]" "${KUBECTL_BINARY} get DataImportCron -A"
Expand Down

0 comments on commit a026fce

Please sign in to comment.