From 5f9b695170f9f88666c08242dd118dac8c8872e7 Mon Sep 17 00:00:00 2001 From: afdesk Date: Mon, 24 Nov 2025 22:39:22 +0600 Subject: [PATCH] test(k8s): update k8s integrtion test (#9725) --- integration/k8s_test.go | 3 +- .../fixtures/k8s/summary-ids.json.golden | 261 +----------------- magefiles/magefile.go | 12 +- 3 files changed, 14 insertions(+), 262 deletions(-) diff --git a/integration/k8s_test.go b/integration/k8s_test.go index c988128697..2f93b245cd 100644 --- a/integration/k8s_test.go +++ b/integration/k8s_test.go @@ -42,7 +42,8 @@ func TestK8s(t *testing.T) { "summary", "--checks-bundle-repository", "mirror.gcr.io/aquasec/trivy-checks:1.11.2@sha256:f3ea8227f838a985f0c884909e9d226362f5fc5ab6021310a179fbb24c5b57fd", - "-q", + "--include-namespaces", "default", + "--debug", "--timeout", "5m0s", "--format", diff --git a/integration/testdata/fixtures/k8s/summary-ids.json.golden b/integration/testdata/fixtures/k8s/summary-ids.json.golden index 9c1f870b7a..bb3ecfbd73 100644 --- a/integration/testdata/fixtures/k8s/summary-ids.json.golden +++ b/integration/testdata/fixtures/k8s/summary-ids.json.golden @@ -1,290 +1,31 @@ { "vulnerabilities": [ "CVE-2019-1551", - "CVE-2019-1551", - "CVE-2019-1563", "CVE-2019-1563", "CVE-2019-18276", - "CVE-2019-18276", - "CVE-2019-5094", - "CVE-2019-5094", - "CVE-2019-5094", - "CVE-2019-5094", "CVE-2019-5094", "CVE-2019-5094", "CVE-2019-5094", "CVE-2019-5094" ], "misconfigurations": [ - "AVD-KSV-01010", - "KCV0001", - "KCV0006", - "KCV0010", - "KCV0018", - "KCV0019", - "KCV0020", - "KCV0021", - "KCV0022", - "KCV0030", - "KCV0033", - "KCV0038", - "KCV0059", - "KCV0069", - "KCV0075", - "KCV0077", "KSV001", - "KSV001", - "KSV001", - "KSV001", - "KSV001", - "KSV001", - "KSV001", - "KSV001", - "KSV001", - "KSV0012", - "KSV003", - "KSV003", - "KSV003", - "KSV003", - "KSV003", - "KSV003", - "KSV003", - "KSV003", "KSV003", "KSV004", - "KSV004", - "KSV004", - "KSV004", - "KSV004", - "KSV004", - "KSV004", - "KSV004", - "KSV004", - "KSV009", - "KSV009", - "KSV009", - "KSV009", - "KSV009", - "KSV009", - "KSV011", - "KSV011", - "KSV011", - "KSV011", - "KSV011", - "KSV011", - "KSV011", - "KSV011", "KSV011", "KSV012", - "KSV012", - "KSV012", - "KSV012", - "KSV012", - "KSV012", - "KSV012", - "KSV012", - "KSV012", - "KSV012", - "KSV0125", - "KSV0125", - "KSV0125", - "KSV0125", - "KSV0125", - "KSV0125", - "KSV0125", - "KSV0125", - "KSV014", - "KSV014", - "KSV014", - "KSV014", - "KSV014", - "KSV014", - "KSV014", - "KSV014", "KSV014", "KSV015", - "KSV015", - "KSV015", - "KSV015", "KSV016", - "KSV016", - "KSV016", - "KSV016", - "KSV016", - "KSV016", - "KSV016", - "KSV017", - "KSV018", - "KSV018", - "KSV018", - "KSV018", - "KSV018", - "KSV018", - "KSV018", "KSV018", "KSV020", - "KSV020", - "KSV020", - "KSV020", - "KSV020", - "KSV020", - "KSV020", - "KSV020", - "KSV020", - "KSV020", "KSV021", - "KSV021", - "KSV021", - "KSV021", - "KSV021", - "KSV021", - "KSV021", - "KSV021", - "KSV021", - "KSV021", - "KSV022", - "KSV022", - "KSV023", - "KSV023", - "KSV023", - "KSV023", - "KSV023", - "KSV023", "KSV030", - "KSV030", - "KSV030", - "KSV030", - "KSV030", - "KSV030", - "KSV036", - "KSV041", - "KSV041", - "KSV041", - "KSV041", - "KSV041", - "KSV041", - "KSV041", - "KSV041", - "KSV041", - "KSV041", - "KSV041", - "KSV041", - "KSV041", - "KSV044", - "KSV045", - "KSV046", - "KSV046", - "KSV046", - "KSV046", - "KSV046", - "KSV046", - "KSV046", - "KSV048", - "KSV048", - "KSV048", - "KSV048", - "KSV048", - "KSV048", - "KSV048", - "KSV048", - "KSV048", - "KSV048", - "KSV048", - "KSV048", - "KSV048", - "KSV048", - "KSV048", - "KSV048", - "KSV048", - "KSV048", - "KSV048", - "KSV048", - "KSV048", - "KSV048", - "KSV048", - "KSV048", - "KSV048", - "KSV048", - "KSV048", - "KSV048", - "KSV048", - "KSV048", - "KSV048", - "KSV048", - "KSV048", - "KSV048", - "KSV048", - "KSV048", - "KSV049", - "KSV049", - "KSV049", - "KSV049", - "KSV049", - "KSV049", - "KSV049", - "KSV049", - "KSV050", - "KSV050", - "KSV053", - "KSV053", - "KSV053", - "KSV056", - "KSV056", - "KSV056", - "KSV056", - "KSV056", - "KSV056", - "KSV056", - "KSV056", - "KSV056", - "KSV056", - "KSV056", - "KSV056", - "KSV056", - "KSV056", - "KSV056", - "KSV056", - "KSV056", - "KSV056", - "KSV056", "KSV104", - "KSV104", - "KSV104", - "KSV104", - "KSV104", - "KSV104", - "KSV106", - "KSV106", - "KSV106", - "KSV106", - "KSV106", - "KSV106", - "KSV106", - "KSV106", "KSV106", "KSV110", - "KSV111", - "KSV112", - "KSV112", - "KSV113", - "KSV113", - "KSV117", - "KSV117", "KSV117", "KSV118", - "KSV118", - "KSV118", - "KSV118", - "KSV118", - "KSV118", - "KSV118", - "KSV118", - "KSV118", - "KSV119", - "KSV122", - "no-user-pods-in-system-namespace", - "no-user-pods-in-system-namespace", - "no-user-pods-in-system-namespace", - "no-user-pods-in-system-namespace" + "KSV118" ] } diff --git a/magefiles/magefile.go b/magefiles/magefile.go index b9a9546010..703e1f8189 100644 --- a/magefiles/magefile.go +++ b/magefiles/magefile.go @@ -252,10 +252,20 @@ func (t Test) K8s() error { return fmt.Errorf("can't create environment for limited user: %w", err) } + // wait for all pods are running correctly + err = sh.RunWithV(ENV, "kubectl", "wait", "--for=condition=Ready", "pod", "--all", "--all-namespaces", "--timeout=300s") + if err != nil { + return fmt.Errorf("can't wait for the pods: %w", err) + } + // print all resources for info err = sh.RunWithV(ENV, "kubectl", "get", "all", "-A") if err != nil { - return err + return fmt.Errorf("can't get workloads: %w", err) + } + err = sh.RunWithV(ENV, "kubectl", "get", "cm", "-A") + if err != nil { + return fmt.Errorf("can't get configmaps: %w", err) } return sh.RunWithV(ENV, "go", "test", "-v", "-tags=k8s_integration", "./integration/...")