test: wait for Serf check in TestServicesWatch (#6867)

Following example from TestNodesWatch

* test: WaitForSerfCheck all the places in api/watch_funcs_test.go
This commit is contained in:
Mike Morris 2019-12-04 12:37:10 -05:00 committed by GitHub
parent 66b8c20990
commit 7484b42b93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 0 deletions

View File

@ -300,6 +300,8 @@ func TestServicesWatch(t *testing.T) {
c, s := makeClient(t) c, s := makeClient(t)
defer s.Stop() defer s.Stop()
s.WaitForSerfCheck(t)
var ( var (
wakeups []map[string][]string wakeups []map[string][]string
notifyCh = make(chan struct{}) notifyCh = make(chan struct{})
@ -447,6 +449,8 @@ func TestServiceWatch(t *testing.T) {
c, s := makeClient(t) c, s := makeClient(t)
defer s.Stop() defer s.Stop()
s.WaitForSerfCheck(t)
var ( var (
wakeups [][]*api.ServiceEntry wakeups [][]*api.ServiceEntry
notifyCh = make(chan struct{}) notifyCh = make(chan struct{})
@ -515,6 +519,8 @@ func TestServiceMultipleTagsWatch(t *testing.T) {
c, s := makeClient(t) c, s := makeClient(t)
defer s.Stop() defer s.Stop()
s.WaitForSerfCheck(t)
var ( var (
wakeups [][]*api.ServiceEntry wakeups [][]*api.ServiceEntry
notifyCh = make(chan struct{}) notifyCh = make(chan struct{})
@ -606,6 +612,8 @@ func TestChecksWatch_State(t *testing.T) {
c, s := makeClient(t) c, s := makeClient(t)
defer s.Stop() defer s.Stop()
s.WaitForSerfCheck(t)
var ( var (
wakeups [][]*api.HealthCheck wakeups [][]*api.HealthCheck
notifyCh = make(chan struct{}) notifyCh = make(chan struct{})
@ -680,6 +688,8 @@ func TestChecksWatch_Service(t *testing.T) {
c, s := makeClient(t) c, s := makeClient(t)
defer s.Stop() defer s.Stop()
s.WaitForSerfCheck(t)
var ( var (
wakeups [][]*api.HealthCheck wakeups [][]*api.HealthCheck
notifyCh = make(chan struct{}) notifyCh = make(chan struct{})
@ -884,6 +894,8 @@ func TestConnectLeafWatch(t *testing.T) {
c, s := makeClient(t) c, s := makeClient(t)
defer s.Stop() defer s.Stop()
s.WaitForSerfCheck(t)
// Register a web service to get certs for // Register a web service to get certs for
{ {
agent := c.Agent() agent := c.Agent()
@ -966,6 +978,8 @@ func TestAgentServiceWatch(t *testing.T) {
c, s := makeClient(t) c, s := makeClient(t)
defer s.Stop() defer s.Stop()
s.WaitForSerfCheck(t)
var ( var (
wakeups []*api.AgentService wakeups []*api.AgentService
notifyCh = make(chan struct{}) notifyCh = make(chan struct{})