From 1c1b88bc6a0060712a2f5942a2a474b400fd827b Mon Sep 17 00:00:00 2001 From: Dhia Ayachi Date: Thu, 16 Mar 2023 09:37:55 -0400 Subject: [PATCH] make sure we read the logs from a followers to test the follower snapshot install path. --- .../test/snapshot/snapshot_restore_test.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/test/integration/consul-container/test/snapshot/snapshot_restore_test.go b/test/integration/consul-container/test/snapshot/snapshot_restore_test.go index 56cad07d47..1d82b1cfb1 100644 --- a/test/integration/consul-container/test/snapshot/snapshot_restore_test.go +++ b/test/integration/consul-container/test/snapshot/snapshot_restore_test.go @@ -79,8 +79,16 @@ func testSnapShotRestoreForLogStore(t *testing.T, logStore libcluster.LogStore) libcluster.WaitForLeader(t, cluster2, client2) + followers, err := cluster2.Followers() + require.NoError(t, err) + require.Len(t, followers, 2) + + // use a follower api client and set `AllowStale` to true + // to test the follower snapshot install code path as well. + fc := followers[0].GetClient() + for i := 0; i < 100; i++ { - kv, _, err := client2.KV().Get(fmt.Sprintf("key-%d", i), &api.QueryOptions{AllowStale: true}) + kv, _, err := fc.KV().Get(fmt.Sprintf("key-%d", i), &api.QueryOptions{AllowStale: true}) require.NoError(t, err) require.Equal(t, kv.Key, fmt.Sprintf("key-%d", i)) require.Equal(t, kv.Value, []byte(fmt.Sprintf("value-%d", i)))