Skip to content

Commit

Permalink
Addresses the flakiness of CatalogNodes (hashicorp#4530)
Browse files Browse the repository at this point in the history
  • Loading branch information
MagnumOpus21 authored Aug 15, 2018
1 parent 14f19f7 commit 771e0ba
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion api/catalog_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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,
},
}
Expand Down

0 comments on commit 771e0ba

Please sign in to comment.