From d4da6e5df49815f3a399c1b634a030fddebd59a8 Mon Sep 17 00:00:00 2001 From: afdesk Date: Fri, 22 Nov 2024 09:32:18 +0600 Subject: [PATCH] chore: bump up kind for k8s v1.31 (#2318) * chore: bump up kind for k8s v1.31 * chore: bump up setup-kind to v0.6.2 * test: remove deprecated k8s API * chore: add report in the failure log * chore: increase timeout for building cluster report * fix: add newlines * chore: update copmuted hash for k8s v1.31.0 * chore: remove reports printing for debug * test: looking for a name in ClusterVulnerabilityReport --- .github/workflows/build.yaml | 6 +++--- tests/e2e/cluster/workload/00-assert.yaml | 12 ++++++------ tests/itest/trivy-operator/behavior/behavior.go | 9 ++++----- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index cb597213c..cba309a1a 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -22,8 +22,8 @@ on: - LICENSE - NOTICE env: - KIND_VERSION: v0.17.0 - KIND_IMAGE: kindest/node:v1.21.1@sha256:69860bda5563ac81e3c0057d654b5253219618a22ec3a346306239bba8cfa1a6 + KIND_VERSION: v0.24.0 + KIND_IMAGE: kindest/node:v1.31.2 GO_VERSION: '1.22' permissions: {} concurrency: @@ -120,7 +120,7 @@ jobs: with: aqua_version: v1.25.0 - name: Setup Kubernetes cluster (KIND) - uses: engineerd/setup-kind@v0.5.0 + uses: engineerd/setup-kind@v0.6.2 with: version: ${{ env.KIND_VERSION }} image: ${{ env.KIND_IMAGE }} diff --git a/tests/e2e/cluster/workload/00-assert.yaml b/tests/e2e/cluster/workload/00-assert.yaml index ed0b4bb8e..890e7844a 100644 --- a/tests/e2e/cluster/workload/00-assert.yaml +++ b/tests/e2e/cluster/workload/00-assert.yaml @@ -2,15 +2,15 @@ apiVersion: kuttl.dev/v1beta1 commands: - script: > - cnt="$(kubectl get clustervulnerabilityreports.aquasecurity.github.io clustersbomreport-557764dbc-k8s-cluster \ - -o=jsonpath='{.report.summary.highCount}')" - if [ $cnt -gt 0 ] + name="$(kubectl get clustervulnerabilityreports.aquasecurity.github.io clustersbomreport-6789697bc-k8s-cluster \ + -o=jsonpath='{.metadata.name}')" + if [ $name = "clustersbomreport-6789697bc-k8s-cluster" ] then - echo "Pass: ClusterVulnerabilityReport highCount ($cnt) is greater than 0" + echo "Pass: ClusterVulnerabilityReport was created successfully" else - echo "Fail: ClusterVulnerabilityReport highCount ($cnt) should be greater than 0" + echo "Fail: ClusterVulnerabilityReport name doesn't exist" exit 1 fi kind: TestAssert -timeout: 120 +timeout: 240 diff --git a/tests/itest/trivy-operator/behavior/behavior.go b/tests/itest/trivy-operator/behavior/behavior.go index 187ff650c..31db4a600 100644 --- a/tests/itest/trivy-operator/behavior/behavior.go +++ b/tests/itest/trivy-operator/behavior/behavior.go @@ -10,7 +10,6 @@ import ( "github.com/aquasecurity/trivy-operator/tests/itest/helper" appsv1 "k8s.io/api/apps/v1" batchv1 "k8s.io/api/batch/v1" - batchv1beta1 "k8s.io/api/batch/v1beta1" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" @@ -324,18 +323,18 @@ func ConfigurationCheckerBehavior(inputs *Inputs) func() { Context("When CronJob is created", func() { var ctx context.Context - var cronJob *batchv1beta1.CronJob + var cronJob *batchv1.CronJob BeforeEach(func() { ctx = context.Background() - cronJob = &batchv1beta1.CronJob{ + cronJob = &batchv1.CronJob{ ObjectMeta: metav1.ObjectMeta{ Namespace: inputs.PrimaryNamespace, Name: "hello-" + rand.String(5), }, - Spec: batchv1beta1.CronJobSpec{ + Spec: batchv1.CronJobSpec{ Schedule: "*/1 * * * *", - JobTemplate: batchv1beta1.JobTemplateSpec{ + JobTemplate: batchv1.JobTemplateSpec{ Spec: batchv1.JobSpec{ Template: corev1.PodTemplateSpec{ Spec: corev1.PodSpec{