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.
This commit is contained in:
Mahmood Ali
2021-06-07 17:36:41 -04:00
parent 398d81ccf1
commit 7badf0fda2

View File

@@ -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