From 5d48c492a4a302247c3bfbf088fb0aaff3527075 Mon Sep 17 00:00:00 2001 From: Alex Dadgar Date: Sun, 18 Dec 2016 16:54:12 -0800 Subject: [PATCH] Fix test --- command/agent/job_endpoint_test.go | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/command/agent/job_endpoint_test.go b/command/agent/job_endpoint_test.go index 5ef1af572..219b879df 100644 --- a/command/agent/job_endpoint_test.go +++ b/command/agent/job_endpoint_test.go @@ -217,13 +217,10 @@ func TestHTTP_JobQuery_Payload(t *testing.T) { compressed := snappy.Encode(nil, expected) job.Payload = compressed - args := structs.JobRegisterRequest{ - Job: job, - WriteRequest: structs.WriteRequest{Region: "global"}, - } - var resp structs.JobRegisterResponse - if err := s.Agent.RPC("Job.Register", &args, &resp); err != nil { - t.Fatalf("err: %v", err) + // Directly manipulate the state + state := s.Agent.server.State() + if err := state.UpsertJob(1000, job); err != nil { + t.Fatalf("Failed to upsert job: %v", err) } // Make the HTTP request