2015-09-11 18:10:20 +00:00
|
|
|
package command
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2015-09-12 21:50:05 +00:00
|
|
|
"github.com/hashicorp/nomad/api"
|
|
|
|
"github.com/hashicorp/nomad/testutil"
|
2015-09-11 18:10:20 +00:00
|
|
|
)
|
|
|
|
|
2015-09-12 23:12:56 +00:00
|
|
|
func testServer(t *testing.T) (*testutil.TestServer, *api.Client, string) {
|
2015-09-13 18:39:49 +00:00
|
|
|
// Always run these tests in parallel.
|
|
|
|
t.Parallel()
|
|
|
|
|
2015-09-12 23:12:56 +00:00
|
|
|
// Make a new test server
|
|
|
|
srv := testutil.NewTestServer(t, nil)
|
2015-09-12 21:50:05 +00:00
|
|
|
|
|
|
|
// Make a client
|
|
|
|
clientConf := api.DefaultConfig()
|
2015-09-14 20:13:52 +00:00
|
|
|
clientConf.Address = "http://" + srv.HTTPAddr
|
2015-09-12 21:50:05 +00:00
|
|
|
client, err := api.NewClient(clientConf)
|
|
|
|
if err != nil {
|
|
|
|
t.Fatalf("err: %s", err)
|
|
|
|
}
|
2015-09-14 20:13:52 +00:00
|
|
|
return srv, client, clientConf.Address
|
2015-09-11 18:10:20 +00:00
|
|
|
}
|