Skip to content

Commit 89f4991

Browse files
committed
fix
Signed-off-by: Tomasz Janiszewski <[email protected]>
1 parent 73e2263 commit 89f4991

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

pkg/lintcontext/create_contexts_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ func TestCreateContextsWithIgnorePaths(t *testing.T) {
3131
"../../.pre-commit-hooks*",
3232
"../../dist/**/*",
3333
"../../pkg/**/*",
34+
"../../demo/**",
35+
"../../stackrox-kube-linter-bug-example/**",
36+
"../../tests/**/*",
37+
"../../cmd/**/*",
38+
"../../docs/**/*",
39+
"../../internal/**/*",
3440
"/**/*/checks/**/*",
3541
"/**/*/test_helper/**/*",
3642
"/**/*/testdata/**/*",

pkg/lintcontext/parse_yaml_test.go

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ spec:
185185
}
186186

187187
func TestParseObjectsWithCustomDecoder(t *testing.T) {
188-
// Test that parseObjects respects the custom decoder parameter
188+
// Test that parseObjects can handle CRDs by falling back to unstructured parsing
189189
tektonTaskYAML := `apiVersion: tekton.dev/v1
190190
kind: Task
191191
metadata:
@@ -200,15 +200,19 @@ spec:
200200
args:
201201
- "Hello World!"`
202202

203-
// Test with default decoder (should fail)
203+
// Test with default decoder (should succeed by falling back to unstructured)
204204
objects, err := parseObjects([]byte(tektonTaskYAML), nil)
205-
assert.Error(t, err, "Expected Tekton Task to fail with default decoder")
206-
assert.Empty(t, objects)
205+
assert.NoError(t, err, "Expected Tekton Task to parse as unstructured with default decoder")
206+
assert.Len(t, objects, 1)
207+
assert.Equal(t, "Task", objects[0].GetObjectKind().GroupVersionKind().Kind)
208+
assert.Equal(t, "hello-world-task", objects[0].GetName())
207209

208-
// Test with explicit decoder (should also fail since we're using the same decoder)
210+
// Test with explicit decoder (should also succeed)
209211
objects, err = parseObjects([]byte(tektonTaskYAML), decoder)
210-
assert.Error(t, err, "Expected Tekton Task to fail with current scheme")
211-
assert.Empty(t, objects)
212+
assert.NoError(t, err, "Expected Tekton Task to parse as unstructured with explicit decoder")
213+
assert.Len(t, objects, 1)
214+
assert.Equal(t, "Task", objects[0].GetObjectKind().GroupVersionKind().Kind)
215+
assert.Equal(t, "hello-world-task", objects[0].GetName())
212216
}
213217

214218
func TestParseObjectsEmptyInput(t *testing.T) {

0 commit comments

Comments
 (0)