From 771e0bafd20e08421bacc879b4b0528aad63899c Mon Sep 17 00:00:00 2001 From: Siva Prasad Date: Wed, 15 Aug 2018 11:16:05 -0400 Subject: [PATCH] Addresses the flakiness of CatalogNodes (#4530) --- api/catalog_test.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/api/catalog_test.go b/api/catalog_test.go index e384a001c2b1..6151048d7748 100644 --- a/api/catalog_test.go +++ b/api/catalog_test.go @@ -33,6 +33,9 @@ func TestAPI_CatalogNodes(t *testing.T) { catalog := c.Catalog() retry.RunWith(retry.ThreeTimes(), t, func(r *retry.R) { nodes, meta, err := catalog.Nodes(nil) + // We're not concerned about the createIndex of an agent + // Hence we're setting it to the default value + nodes[0].CreateIndex = 0 if err != nil { r.Fatal(err) } @@ -52,7 +55,12 @@ func TestAPI_CatalogNodes(t *testing.T) { Meta: map[string]string{ "consul-network-segment": "", }, - CreateIndex: meta.LastIndex - 1, + // CreateIndex will never always be meta.LastIndex - 1 + // The purpose of this test is not to test CreateIndex value of an agent + // rather to check if the client agent can get the correct number + // of agents with a particular service, KV pair, etc... + // Hence reverting this to the default value here. + CreateIndex: 0, ModifyIndex: meta.LastIndex, }, }