Repository: kyverno/chainsaw
Pull request #483 (2023-11-24 12:39:42)

fix: error manifests discovery error
Fix error manifests discovery error.


Patch:
diff --git a/.release-notes/main.md b/.release-notes/main.md
index 31ef2538..0edf53fb 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/load.go b/pkg/discovery/load.go
index 817c6981..069b6aa4 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,


Test patch:
diff --git a/pkg/discovery/discovery_test.go b/pkg/discovery/discovery_test.go
index 9e507d0b..83cf1ac8 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_test.go b/pkg/discovery/load_test.go
index 46e6857b..2ae903e8 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 c884928a..3ebcf51f 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