Merge pull request #516 from mtchavez/tests/fix-failing

Tests/fix failing
This commit is contained in:
Armon Dadgar 2014-12-05 18:50:30 -08:00
commit 66dc7752e0
2 changed files with 21 additions and 3 deletions

View File

@ -386,8 +386,10 @@ func TestAgent_ConsulService(t *testing.T) {
func TestAgent_PersistService(t *testing.T) {
config := nextConfig()
config.Server = false
dir, agent := makeAgent(t, config)
defer os.RemoveAll(dir)
defer agent.Shutdown()
svc := &structs.NodeService{
ID: "redis",
@ -444,6 +446,7 @@ func TestAgent_PurgeService(t *testing.T) {
config := nextConfig()
dir, agent := makeAgent(t, config)
defer os.RemoveAll(dir)
defer agent.Shutdown()
svc := &structs.NodeService{
ID: "redis",
@ -476,8 +479,10 @@ func TestAgent_PurgeService(t *testing.T) {
func TestAgent_PurgeServiceOnDuplicate(t *testing.T) {
config := nextConfig()
config.Server = false
dir, agent := makeAgent(t, config)
defer os.RemoveAll(dir)
defer agent.Shutdown()
svc1 := &structs.NodeService{
ID: "redis",
@ -523,8 +528,10 @@ func TestAgent_PurgeServiceOnDuplicate(t *testing.T) {
func TestAgent_PersistCheck(t *testing.T) {
config := nextConfig()
config.Server = false
dir, agent := makeAgent(t, config)
defer os.RemoveAll(dir)
defer agent.Shutdown()
check := &structs.HealthCheck{
Node: config.NodeName,
@ -597,6 +604,7 @@ func TestAgent_PurgeCheck(t *testing.T) {
config := nextConfig()
dir, agent := makeAgent(t, config)
defer os.RemoveAll(dir)
defer agent.Shutdown()
check := &structs.HealthCheck{
Node: config.NodeName,
@ -631,8 +639,10 @@ func TestAgent_PurgeCheck(t *testing.T) {
func TestAgent_PurgeCheckOnDuplicate(t *testing.T) {
config := nextConfig()
config.Server = false
dir, agent := makeAgent(t, config)
defer os.RemoveAll(dir)
defer agent.Shutdown()
check1 := &structs.HealthCheck{
Node: config.NodeName,

View File

@ -256,10 +256,12 @@ func TestServer_Leave(t *testing.T) {
}
// Should lose a peer
p1, _ = s1.raftPeers.Peers()
if len(p1) != 1 {
testutil.WaitForResult(func() (bool, error) {
p1, _ = s1.raftPeers.Peers()
return len(p1) == 1, nil
}, func(err error) {
t.Fatalf("should have 1 peer: %v", p1)
}
})
}
func TestServer_RPC(t *testing.T) {
@ -489,6 +491,12 @@ func TestServer_globalRPCErrors(t *testing.T) {
defer os.RemoveAll(dir1)
defer s1.Shutdown()
testutil.WaitForResult(func() (bool, error) {
return len(s1.remoteConsuls) == 1, nil
}, func(err error) {
t.Fatalf("Server did not join LAN successfully")
})
// Check that an error from a remote DC is returned
err := s1.globalRPC("Bad.Method", nil, &fakeGlobalResp{})
if err == nil {