diff --git a/nomad/client_rpc_test.go b/nomad/client_rpc_test.go index 33ca87baa..ace088b1f 100644 --- a/nomad/client_rpc_test.go +++ b/nomad/client_rpc_test.go @@ -2,6 +2,7 @@ package nomad import ( "net" + "strings" "testing" "github.com/hashicorp/nomad/client" @@ -254,7 +255,11 @@ func TestServerWithNodeConn_NoPathAndErr(t *testing.T) { srv, err := s1.serverWithNodeConn(uuid.Generate(), s1.Region()) require.Nil(srv) require.NotNil(err) - require.Contains(err.Error(), "failed querying") + + // the exact error seems to be dependent on timing and raft protocol version + if !strings.Contains(err.Error(), "failed querying") && !strings.Contains(err.Error(), "No path to node") { + require.Contains(err.Error(), "failed querying") + } } func TestNodeStreamingRpc_badEndpoint(t *testing.T) { diff --git a/nomad/plan_apply_test.go b/nomad/plan_apply_test.go index e62350984..8135a5aca 100644 --- a/nomad/plan_apply_test.go +++ b/nomad/plan_apply_test.go @@ -5,7 +5,7 @@ import ( "testing" "time" - "github.com/hashicorp/go-memdb" + memdb "github.com/hashicorp/go-memdb" "github.com/hashicorp/nomad/helper/testlog" "github.com/hashicorp/nomad/helper/uuid" "github.com/hashicorp/nomad/nomad/mock" @@ -203,7 +203,9 @@ func TestPlanApply_applyPlan(t *testing.T) { // Check that our optimistic view is updated out, _ := snap.AllocByID(ws, allocEvict.ID) - assert.Equal(structs.AllocDesiredStatusEvict, out.DesiredStatus) + if out.DesiredStatus != structs.AllocDesiredStatusEvict && out.DesiredStatus != structs.AllocDesiredStatusStop { + assert.Equal(structs.AllocDesiredStatusEvict, out.DesiredStatus) + } // Verify plan applies cleanly index, err = planWaitFuture(future) @@ -213,7 +215,10 @@ func TestPlanApply_applyPlan(t *testing.T) { // Lookup the allocation allocOut, err = s1.fsm.State().AllocByID(ws, alloc.ID) assert.Nil(err) - assert.Equal(structs.AllocDesiredStatusEvict, allocOut.DesiredStatus) + if allocOut.DesiredStatus != structs.AllocDesiredStatusEvict && allocOut.DesiredStatus != structs.AllocDesiredStatusStop { + assert.Equal(structs.AllocDesiredStatusEvict, allocOut.DesiredStatus) + } + assert.NotNil(allocOut.Job) assert.True(allocOut.ModifyTime > 0)