Skip to content

Commit

Permalink
Update test to expect specific params
Browse files Browse the repository at this point in the history
  • Loading branch information
crobby committed Mar 27, 2024
1 parent 1ef5fa4 commit 2189f65
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ import (
"k8s.io/apimachinery/pkg/runtime"
)

const (
testNamespace = "testclusternamespace"
)

var (
cpcGVR = metav1.GroupVersionResource{Group: "management.cattle.io", Version: "v3", Resource: "clusterproxyconfigs"}
cpcGVK = metav1.GroupVersionKind{Group: "management.cattle.io", Version: "v3", Kind: "ClusterProxyConfig"}
Expand Down Expand Up @@ -51,7 +55,7 @@ func Test_admitter_Admit(t *testing.T) {
t.Parallel()
ctrl := gomock.NewController(t)
cpsCache := wranglerfake.NewMockCacheInterface[*v3api.ClusterProxyConfig](ctrl)
cpsCache.EXPECT().List(gomock.Any(), gomock.Any()).DoAndReturn(func(namespace string, _ labels.Selector) ([]*v3api.ClusterProxyConfig, error) {
cpsCache.EXPECT().List(testNamespace, labels.Everything()).DoAndReturn(func(_ string, _ labels.Selector) ([]*v3api.ClusterProxyConfig, error) {
if tt.wantErr {
return nil, fmt.Errorf("simulated list error")
}
Expand Down Expand Up @@ -86,6 +90,7 @@ func createRequest() *admission.Request {
Resource: cpcGVR,
RequestKind: &cpcGVK,
RequestResource: &cpcGVR,
Namespace: testNamespace,
Operation: admissionv1.Create,
UserInfo: authenicationv1.UserInfo{Username: "test-user", UID: ""},
Object: runtime.RawExtension{},
Expand Down

0 comments on commit 2189f65

Please sign in to comment.