From 7badf0fda21610d438220da520b32b1e4e263099 Mon Sep 17 00:00:00 2001 From: Mahmood Ali Date: Mon, 7 Jun 2021 17:36:41 -0400 Subject: [PATCH] tests: deflake CSI forwarding tests This updates `client.Ready()` so it returns once the client node got registered at the servers. Previously, it returns when the fingerprinters first batch completes, wtihout ensuring that the node is stored in the Raft data. The tests may fail later when it with unknown node errors later. `client.Reedy()` seem to be only called in CSI and some client stats now. This class of bug, assuming client is registered without checking, is a source of flakiness elsewhere. Other tests use other mechanisms for checking node readiness, though not consistently. --- client/client.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/client.go b/client/client.go index b334bae2a..61ebed24b 100644 --- a/client/client.go +++ b/client/client.go @@ -287,7 +287,7 @@ type Client struct { batchNodeUpdates *batchNodeUpdates // fpInitialized chan is closed when the first batch of fingerprints are - // applied to the node and the server is updated + // applied to the node fpInitialized chan struct{} // serversContactedCh is closed when GetClientAllocs and runAllocs have @@ -524,7 +524,7 @@ func NewClient(cfg *config.Config, consulCatalog consul.CatalogAPI, consulProxie // wait until drivers are healthy before restoring or registering with servers select { - case <-c.Ready(): + case <-c.fpInitialized: case <-time.After(batchFirstFingerprintsProcessingGrace): logger.Warn("batch fingerprint operation timed out; proceeding to register with fingerprinted plugins so far") } @@ -566,7 +566,7 @@ func NewClient(cfg *config.Config, consulCatalog consul.CatalogAPI, consulProxie // Ready returns a chan that is closed when the client is fully initialized func (c *Client) Ready() <-chan struct{} { - return c.fpInitialized + return c.serversContactedCh } // init is used to initialize the client and perform any setup