Skip to content

Commit 0a85c53

Browse files
committed
Add unit test case to grpc and configmap reconciler test
Signed-off-by: Vu Dinh <[email protected]>
1 parent 07c9c32 commit 0a85c53

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

pkg/controller/registry/reconciler/configmap_test.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,24 @@ func TestConfigMapRegistryReconciler(t *testing.T) {
347347
},
348348
},
349349
},
350+
{
351+
testName: "ExistingRegistry/BadServiceWithWrongHash",
352+
in: in{
353+
cluster: cluster{
354+
k8sObjs: append(setLabel(objectsForCatalogSource(validCatalogSource), &corev1.Service{}, ServiceHashLabelKey, "wrongHash"), validConfigMap),
355+
},
356+
catsrc: validCatalogSource,
357+
},
358+
out: out{
359+
status: &v1alpha1.RegistryServiceStatus{
360+
CreatedAt: now(),
361+
Protocol: "grpc",
362+
ServiceName: "cool-catalog",
363+
ServiceNamespace: testNamespace,
364+
Port: "50051",
365+
},
366+
},
367+
},
350368
{
351369
testName: "ExistingRegistry/BadPod",
352370
in: in{

pkg/controller/registry/reconciler/grpc_test.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,24 @@ func TestGrpcRegistryReconciler(t *testing.T) {
114114
},
115115
},
116116
},
117+
{
118+
testName: "Grpc/ExistingRegistry/BadServiceWithWrongHash",
119+
in: in{
120+
cluster: cluster{
121+
k8sObjs: setLabel(objectsForCatalogSource(validGrpcCatalogSource("test-img", "")), &corev1.Service{}, ServiceHashLabelKey, "wrongHash"),
122+
},
123+
catsrc: validGrpcCatalogSource("test-img", ""),
124+
},
125+
out: out{
126+
status: &v1alpha1.RegistryServiceStatus{
127+
CreatedAt: now(),
128+
Protocol: "grpc",
129+
ServiceName: "img-catalog",
130+
ServiceNamespace: testNamespace,
131+
Port: "50051",
132+
},
133+
},
134+
},
117135
{
118136
testName: "Grpc/ExistingRegistry/BadService",
119137
in: in{

0 commit comments

Comments
 (0)