Skip to content

Commit

Permalink
fix: syncer & services unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
FabianKramm committed Nov 4, 2024
1 parent 275c4f6 commit 6cdca9b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
11 changes: 3 additions & 8 deletions pkg/controllers/resources/services/syncer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,12 +280,6 @@ func TestSync(t *testing.T) {
ObjectMeta: vObjectMeta,
Spec: corev1.ServiceSpec{
ExternalName: "test.com",
Ports: []corev1.ServicePort{
{
Name: "http",
Port: 80,
},
},
},
}
vServiceNodePortFromExternal := &corev1.Service{
Expand Down Expand Up @@ -451,8 +445,9 @@ func TestSync(t *testing.T) {
syncCtx, syncer := syncertesting.FakeStartSyncer(t, ctx, New)
pObj := updateBackwardSpecRecreateService.DeepCopy()
vObj := baseService.DeepCopy()
_, err := syncer.(*serviceSyncer).Sync(syncCtx, synccontext.NewSyncEventWithOld(baseService.DeepCopy(), pObj, vObj, vObj))
result, err := syncer.(*serviceSyncer).Sync(syncCtx, synccontext.NewSyncEventWithOld(baseService.DeepCopy(), pObj, vObj, vObj))
assert.NilError(t, err)
assert.Equal(t, result.Requeue, true)

err = ctx.VirtualManager.GetClient().Get(ctx, types.NamespacedName{Namespace: vObj.Namespace, Name: vObj.Name}, vObj)
assert.NilError(t, err)
Expand All @@ -461,7 +456,7 @@ func TestSync(t *testing.T) {
assert.NilError(t, err)

pObj.Spec.ExternalName = updateBackwardSpecService.Spec.ExternalName
_, err = syncer.(*serviceSyncer).Sync(syncCtx, synccontext.NewSyncEventWithOld(pObj.DeepCopy(), pObj.DeepCopy(), vObj.DeepCopy(), vObj.DeepCopy()))
_, err = syncer.(*serviceSyncer).Sync(syncCtx, synccontext.NewSyncEventWithOld(baseService.DeepCopy(), pObj.DeepCopy(), vObj.DeepCopy(), vObj.DeepCopy()))
assert.NilError(t, err)
},
},
Expand Down
3 changes: 3 additions & 0 deletions pkg/syncer/syncer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,9 @@ func TestReconcile(t *testing.T) {
Namespace: namespaceInVClusterA,
UID: "123",
},
Data: map[string][]byte{
"datakey1": []byte("datavalue1"),
},
},
},

Expand Down

0 comments on commit 6cdca9b

Please sign in to comment.