File tree 5 files changed +63
-1
lines changed
5 files changed +63
-1
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ Release notes for `TODO`.
35
35
- Fixed ` check ` set to ` null ` in kuttl migration command
36
36
- Fixed a manifest discovery issue where manifests could be loaded in the wrong order
37
37
- Fixed a manifest discovery issue where error manifests where not discovered correctly
38
+ - Fixed controller-runtime logger not initialised
38
39
39
40
## :books : Docs :books :
40
41
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ go 1.21.1
5
5
require (
6
6
github.com/dustinkirkland/golang-petname v0.0.0-20231002161417-6a283f1aaaf2
7
7
github.com/fatih/color v1.16.0
8
+ github.com/go-logr/logr v1.2.4
8
9
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
9
10
github.com/jmespath-community/go-jmespath v1.1.2-0.20231004164315-78945398586a
10
11
github.com/kudobuilder/kuttl v0.15.0
@@ -43,7 +44,6 @@ require (
43
44
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
44
45
github.com/felixge/httpsnoop v1.0.3 // indirect
45
46
github.com/fsnotify/fsnotify v1.6.0 // indirect
46
- github.com/go-logr/logr v1.2.4 // indirect
47
47
github.com/go-logr/stdr v1.2.2 // indirect
48
48
github.com/go-openapi/jsonpointer v0.20.0 // indirect
49
49
github.com/go-openapi/jsonreference v0.20.2 // indirect
Original file line number Diff line number Diff line change @@ -3,10 +3,13 @@ package main
3
3
import (
4
4
"os"
5
5
6
+ "github.com/go-logr/logr"
6
7
"github.com/kyverno/chainsaw/pkg/commands"
8
+ "sigs.k8s.io/controller-runtime/pkg/log"
7
9
)
8
10
9
11
func main () {
12
+ log .SetLogger (logr .Discard ())
10
13
root := commands .RootCommand ()
11
14
if err := root .Execute (); err != nil {
12
15
os .Exit (1 )
Original file line number Diff line number Diff line change @@ -68,6 +68,36 @@ func Test_operationCommand(t *testing.T) {
68
68
basePath : ".." ,
69
69
namespace : "test-namespace" ,
70
70
wantErr : false ,
71
+ }, {
72
+ name : "with bad check" ,
73
+ command : v1alpha1.Command {
74
+ Entrypoint : "foo" ,
75
+ Args : []string {"operation.go" },
76
+ SkipLogOutput : true ,
77
+ Check : & v1alpha1.Check {
78
+ Value : map [string ]interface {}{
79
+ "(foo('bar'))" : true ,
80
+ },
81
+ },
82
+ },
83
+ basePath : ".." ,
84
+ namespace : "test-namespace" ,
85
+ wantErr : true ,
86
+ }, {
87
+ name : "with bad check" ,
88
+ command : v1alpha1.Command {
89
+ Entrypoint : "cat" ,
90
+ Args : []string {"operation.go" },
91
+ SkipLogOutput : true ,
92
+ Check : & v1alpha1.Check {
93
+ Value : map [string ]interface {}{
94
+ "(foo('bar'))" : true ,
95
+ },
96
+ },
97
+ },
98
+ basePath : ".." ,
99
+ namespace : "test-namespace" ,
100
+ wantErr : true ,
71
101
}}
72
102
for _ , tt := range tests {
73
103
t .Run (tt .name , func (t * testing.T ) {
Original file line number Diff line number Diff line change @@ -64,6 +64,34 @@ func Test_operationScript(t *testing.T) {
64
64
basePath : ".." ,
65
65
namespace : "test-namespace" ,
66
66
wantErr : false ,
67
+ }, {
68
+ name : "with bad check" ,
69
+ script : v1alpha1.Script {
70
+ Content : "foo" ,
71
+ SkipLogOutput : true ,
72
+ Check : & v1alpha1.Check {
73
+ Value : map [string ]interface {}{
74
+ "(foo('bar'))" : true ,
75
+ },
76
+ },
77
+ },
78
+ basePath : ".." ,
79
+ namespace : "test-namespace" ,
80
+ wantErr : true ,
81
+ }, {
82
+ name : "with bad check" ,
83
+ script : v1alpha1.Script {
84
+ Content : "cat operation.go" ,
85
+ SkipLogOutput : true ,
86
+ Check : & v1alpha1.Check {
87
+ Value : map [string ]interface {}{
88
+ "(foo('bar'))" : true ,
89
+ },
90
+ },
91
+ },
92
+ basePath : ".." ,
93
+ namespace : "test-namespace" ,
94
+ wantErr : true ,
67
95
}}
68
96
for _ , tt := range tests {
69
97
t .Run (tt .name , func (t * testing.T ) {
You can’t perform that action at this time.
0 commit comments