From da9d9de727fb2074546a18bfa46dfcddfaa27469 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charles-Edouard=20Br=C3=A9t=C3=A9ch=C3=A9?= Date: Fri, 24 Nov 2023 13:43:33 +0100 Subject: [PATCH] fix: error manifests discovery error (#483) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Charles-Edouard Brétéché --- .release-notes/main.md | 1 + pkg/discovery/discovery_test.go | 2 +- pkg/discovery/load.go | 4 ++-- pkg/discovery/load_test.go | 4 ++-- .../discovery/manifests/{01-error.yaml => 01-errors.yaml} | 0 .../steps-and-manifests/{01-error.yaml => 01-errors.yaml} | 0 testdata/kuttl/01-step.chainsaw.yaml | 2 -- 7 files changed, 6 insertions(+), 7 deletions(-) rename testdata/discovery/manifests/{01-error.yaml => 01-errors.yaml} (100%) rename testdata/discovery/steps-and-manifests/{01-error.yaml => 01-errors.yaml} (100%) diff --git a/.release-notes/main.md b/.release-notes/main.md index 31ef25382..0edf53fb1 100644 --- a/.release-notes/main.md +++ b/.release-notes/main.md @@ -25,3 +25,4 @@ Release notes for `TODO`. - Fixed a kuttl migration failure in case of unsupported file name - Fixed a potential invalid name when migrating a kuttl test step - Fixed a manifest discovery issue where manifests could be loaded in the wrong order +- Fixed a manifest discovery issue where error manifests where not discovered correctly diff --git a/pkg/discovery/discovery_test.go b/pkg/discovery/discovery_test.go index 9e507d0ba..83cf1ac88 100644 --- a/pkg/discovery/discovery_test.go +++ b/pkg/discovery/discovery_test.go @@ -94,7 +94,7 @@ func TestDiscoverTests(t *testing.T) { }, { Error: &v1alpha1.Error{ FileRef: v1alpha1.FileRef{ - File: "01-error.yaml", + File: "01-errors.yaml", }, }, }}, diff --git a/pkg/discovery/load.go b/pkg/discovery/load.go index 817c69817..069b6aa49 100644 --- a/pkg/discovery/load.go +++ b/pkg/discovery/load.go @@ -111,7 +111,7 @@ func LoadTest(fileName string, path string) (*Test, error) { switch groups[2] { case "assert": assertFiles = append(assertFiles, file) - case "error": + case "errors": errorFiles = append(errorFiles, file) default: otherFiles = append(otherFiles, file) @@ -140,7 +140,7 @@ func LoadTest(fileName string, path string) (*Test, error) { FileRef: fileRef, }, }) - case "error": + case "errors": step.Spec.Try = append(step.Spec.Try, v1alpha1.Operation{ Error: &v1alpha1.Error{ FileRef: fileRef, diff --git a/pkg/discovery/load_test.go b/pkg/discovery/load_test.go index 46e6857bc..2ae903e89 100644 --- a/pkg/discovery/load_test.go +++ b/pkg/discovery/load_test.go @@ -253,7 +253,7 @@ func TestLoadTest(t *testing.T) { }, { Error: &v1alpha1.Error{ FileRef: v1alpha1.FileRef{ - File: "01-error.yaml", + File: "01-errors.yaml", }, }, }}, @@ -298,7 +298,7 @@ func TestLoadTest(t *testing.T) { }, { Error: &v1alpha1.Error{ FileRef: v1alpha1.FileRef{ - File: "01-error.yaml", + File: "01-errors.yaml", }, }, }}, diff --git a/testdata/discovery/manifests/01-error.yaml b/testdata/discovery/manifests/01-errors.yaml similarity index 100% rename from testdata/discovery/manifests/01-error.yaml rename to testdata/discovery/manifests/01-errors.yaml diff --git a/testdata/discovery/steps-and-manifests/01-error.yaml b/testdata/discovery/steps-and-manifests/01-errors.yaml similarity index 100% rename from testdata/discovery/steps-and-manifests/01-error.yaml rename to testdata/discovery/steps-and-manifests/01-errors.yaml diff --git a/testdata/kuttl/01-step.chainsaw.yaml b/testdata/kuttl/01-step.chainsaw.yaml index c884928a9..3ebcf51f0 100755 --- a/testdata/kuttl/01-step.chainsaw.yaml +++ b/testdata/kuttl/01-step.chainsaw.yaml @@ -20,12 +20,10 @@ spec: apiVersion: v1 kind: Pod - script: - check: null content: echo "hello world" skipLogOutput: true - command: args: - hello world - check: null entrypoint: echo skipLogOutput: true