1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2024-12-14 11:57:48 +00:00
kyverno/pkg/utils/admission/dryrun_test.go
Charles-Edouard Brétéché c9bbf38191
refactor: remove more admission request pointers (#6774)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-04-04 13:11:18 +08:00

46 lines
761 B
Go

package admission
import (
"testing"
admissionv1 "k8s.io/api/admission/v1"
)
func TestIsDryRun(t *testing.T) {
true := true
false := false
type args struct {
request admissionv1.AdmissionRequest
}
tests := []struct {
name string
args args
want bool
}{{
args: args{
request: admissionv1.AdmissionRequest{},
},
want: false,
}, {
args: args{
request: admissionv1.AdmissionRequest{
DryRun: &true,
},
},
want: true,
}, {
args: args{
request: admissionv1.AdmissionRequest{
DryRun: &false,
},
},
want: false,
}}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := IsDryRun(tt.args.request); got != tt.want {
t.Errorf("IsDryRun() = %v, want %v", got, tt.want)
}
})
}
}