From cab28b2963eda1ffcda2b8877e66818d8beec32c Mon Sep 17 00:00:00 2001 From: Michael Schurter Date: Thu, 6 Jul 2017 10:17:19 -0700 Subject: [PATCH] Fix api endpoint test --- command/agent/job_endpoint_test.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/command/agent/job_endpoint_test.go b/command/agent/job_endpoint_test.go index 75b8103d7..3d189773a 100644 --- a/command/agent/job_endpoint_test.go +++ b/command/agent/job_endpoint_test.go @@ -4,6 +4,7 @@ import ( "net/http" "net/http/httptest" "reflect" + "strings" "testing" "time" @@ -12,6 +13,7 @@ import ( "github.com/hashicorp/nomad/helper" "github.com/hashicorp/nomad/nomad/mock" "github.com/hashicorp/nomad/nomad/structs" + "github.com/kr/pretty" ) func TestHTTP_JobsList(t *testing.T) { @@ -993,6 +995,7 @@ func TestJobs_ApiJobToStructsJob(t *testing.T) { GetterOptions: map[string]string{ "a": "b", }, + GetterMode: helper.StringToPtr("dir"), RelativeDest: helper.StringToPtr("dest"), }, }, @@ -1178,6 +1181,7 @@ func TestJobs_ApiJobToStructsJob(t *testing.T) { GetterOptions: map[string]string{ "a": "b", }, + GetterMode: "dir", RelativeDest: "dest", }, }, @@ -1213,7 +1217,7 @@ func TestJobs_ApiJobToStructsJob(t *testing.T) { structsJob := ApiJobToStructJob(apiJob) - if !reflect.DeepEqual(expected, structsJob) { - t.Fatalf("bad %#v", structsJob) + if diff := pretty.Diff(expected, structsJob); len(diff) > 0 { + t.Fatalf("bad:\n%s", strings.Join(diff, "\n")) } }