Skip to content

Commit

Permalink
implement stage2 sync
Browse files Browse the repository at this point in the history
Signed-off-by: Matthias Bertschy <[email protected]>
  • Loading branch information
matthyx committed Nov 20, 2023
1 parent 9d427c8 commit 1179213
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions core/synchronizer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,23 @@ func TestSynchronizer_ObjectModified(t *testing.T) {
assert.True(t, ok)
assert.Equal(t, objectV2, serverObj)
}

func TestSynchronizer_ObjectModifiedOnBothSides(t *testing.T) {
ctx, clientAdapter, serverAdapter := initTest(t)
// pre: add object
clientAdapter.Resources[kindKnownServers.String()] = object
serverAdapter.Resources[kindKnownServers.String()] = object
// modify object
objectServerV2 := []byte(`{"kind":"kind","metadata":{"name":"name","version":"server2"}}`)
objectClientV2 := []byte(`{"kind":"kind","metadata":{"name":"name","version":"client2"}}`)
err := clientAdapter.TestCallVerifyObject(ctx, kindKnownServers, objectClientV2)
assert.NoError(t, err)
time.Sleep(1 * time.Second)
// check object modified is the one from the server
clientObj, ok := clientAdapter.Resources[kindKnownServers.String()]
assert.True(t, ok)
assert.Equal(t, objectServerV2, clientObj)
serverObj, ok := clientAdapter.Resources[kindKnownServers.String()]
assert.True(t, ok)
assert.Equal(t, objectServerV2, serverObj)
}

0 comments on commit 1179213

Please sign in to comment.