From b5f9bfa081aa1e78161c676e62f517818adc76bc Mon Sep 17 00:00:00 2001 From: Gregory Newman-Smith <109068393+gregns1@users.noreply.github.com> Date: Fri, 10 Jan 2025 17:09:38 +0000 Subject: [PATCH] CBG-4450: add wait for replication status in TestReplicationConfigUpdatedAt (#7280) --- rest/replicatortest/replicator_test.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/rest/replicatortest/replicator_test.go b/rest/replicatortest/replicator_test.go index a5e1d577a2..84eacac973 100644 --- a/rest/replicatortest/replicator_test.go +++ b/rest/replicatortest/replicator_test.go @@ -8570,6 +8570,8 @@ func TestReplicationConfigUpdatedAt(t *testing.T) { // create a replication and assert the updated at field is present in the config activeRT.CreateReplication("replication1", remoteURLString, db.ActiveReplicatorTypePush, nil, true, db.ConflictResolverDefault) + activeRT.WaitForReplicationStatus("replication1", db.ReplicationStateRunning) + resp := activeRT.SendAdminRequest(http.MethodGet, "/{{.db}}/_replication/replication1", "") var configResponse db.ReplicationConfig require.NoError(t, json.Unmarshal(resp.BodyBytes(), &configResponse)) @@ -8580,12 +8582,11 @@ func TestReplicationConfigUpdatedAt(t *testing.T) { currTime := configResponse.UpdatedAt createdAtTime := configResponse.CreatedAt - // avoid flake where update at seems to be the same (possibly running to fast) - time.Sleep(500 * time.Nanosecond) - resp = activeRT.SendAdminRequest("PUT", "/{{.db}}/_replicationStatus/replication1?action=stop", "") rest.RequireStatus(t, resp, http.StatusOK) + activeRT.WaitForReplicationStatus("replication1", db.ReplicationStateStopped) + // update the config resp = activeRT.SendAdminRequest(http.MethodPut, "/{{.db}}/_replication/replication1", fmt.Sprintf(`{"name":"replication1","source":"%s","type":"push", "continuous":true}`, remoteURLString)) rest.RequireStatus(t, resp, http.StatusOK)