Switch to in-process agent

This commit is contained in:
Alex Dadgar
2017-07-20 21:07:32 -07:00
parent 57e34b66ea
commit da25a3d5ce
20 changed files with 64 additions and 83 deletions

View File

@@ -5,6 +5,7 @@ import (
"strings"
"testing"
"github.com/hashicorp/nomad/command/agent"
"github.com/hashicorp/nomad/testutil"
"github.com/mitchellh/cli"
)
@@ -15,11 +16,10 @@ func TestNodeStatusCommand_Implements(t *testing.T) {
func TestNodeStatusCommand_Self(t *testing.T) {
// Start in dev mode so we get a node registration
srv, client, url := testServer(t, func(c *testutil.TestServerConfig) {
c.DevMode = true
srv, client, url := testServer(t, true, func(c *agent.Config) {
c.NodeName = "mynode"
})
defer srv.Stop()
defer srv.Shutdown()
ui := new(cli.MockUi)
cmd := &NodeStatusCommand{Meta: Meta{Ui: ui}}
@@ -66,11 +66,10 @@ func TestNodeStatusCommand_Self(t *testing.T) {
func TestNodeStatusCommand_Run(t *testing.T) {
// Start in dev mode so we get a node registration
srv, client, url := testServer(t, func(c *testutil.TestServerConfig) {
c.DevMode = true
srv, client, url := testServer(t, true, func(c *agent.Config) {
c.NodeName = "mynode"
})
defer srv.Stop()
defer srv.Shutdown()
ui := new(cli.MockUi)
cmd := &NodeStatusCommand{Meta: Meta{Ui: ui}}
@@ -160,8 +159,8 @@ func TestNodeStatusCommand_Run(t *testing.T) {
}
func TestNodeStatusCommand_Fails(t *testing.T) {
srv, _, url := testServer(t, nil)
defer srv.Stop()
srv, _, url := testServer(t, false, nil)
defer srv.Shutdown()
ui := new(cli.MockUi)
cmd := &NodeStatusCommand{Meta: Meta{Ui: ui}}