mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 10:25:42 +03:00
Fix wrong types
This commit is contained in:
@@ -225,10 +225,10 @@ func TestHTTP_JobsRegister_Defaulting(t *testing.T) {
|
||||
func TestHTTP_JobQuery(t *testing.T) {
|
||||
httpTest(t, nil, func(s *TestServer) {
|
||||
// Create the job
|
||||
job := api.MockJob()
|
||||
args := api.JobRegisterRequest{
|
||||
job := mock.Job()
|
||||
args := structs.JobRegisterRequest{
|
||||
Job: job,
|
||||
WriteRequest: api.WriteRequest{Region: "global"},
|
||||
WriteRequest: structs.WriteRequest{Region: "global"},
|
||||
}
|
||||
var resp structs.JobRegisterResponse
|
||||
if err := s.Agent.RPC("Job.Register", &args, &resp); err != nil {
|
||||
@@ -236,7 +236,7 @@ func TestHTTP_JobQuery(t *testing.T) {
|
||||
}
|
||||
|
||||
// Make the HTTP request
|
||||
req, err := http.NewRequest("GET", "/v1/job/"+*job.ID, nil)
|
||||
req, err := http.NewRequest("GET", "/v1/job/"+job.ID, nil)
|
||||
if err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
@@ -261,7 +261,7 @@ func TestHTTP_JobQuery(t *testing.T) {
|
||||
|
||||
// Check the job
|
||||
j := obj.(*structs.Job)
|
||||
if j.ID != *job.ID {
|
||||
if j.ID != job.ID {
|
||||
t.Fatalf("bad: %#v", j)
|
||||
}
|
||||
})
|
||||
@@ -373,10 +373,10 @@ func TestHTTP_JobUpdate(t *testing.T) {
|
||||
func TestHTTP_JobDelete(t *testing.T) {
|
||||
httpTest(t, nil, func(s *TestServer) {
|
||||
// Create the job
|
||||
job := api.MockJob()
|
||||
args := api.JobRegisterRequest{
|
||||
job := mock.Job()
|
||||
args := structs.JobRegisterRequest{
|
||||
Job: job,
|
||||
WriteRequest: api.WriteRequest{Region: "global"},
|
||||
WriteRequest: structs.WriteRequest{Region: "global"},
|
||||
}
|
||||
var resp structs.JobRegisterResponse
|
||||
if err := s.Agent.RPC("Job.Register", &args, &resp); err != nil {
|
||||
@@ -384,7 +384,7 @@ func TestHTTP_JobDelete(t *testing.T) {
|
||||
}
|
||||
|
||||
// Make the HTTP request
|
||||
req, err := http.NewRequest("DELETE", "/v1/job/"+*job.ID, nil)
|
||||
req, err := http.NewRequest("DELETE", "/v1/job/"+job.ID, nil)
|
||||
if err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
@@ -409,7 +409,7 @@ func TestHTTP_JobDelete(t *testing.T) {
|
||||
|
||||
// Check the job is gone
|
||||
getReq := structs.JobSpecificRequest{
|
||||
JobID: *job.ID,
|
||||
JobID: job.ID,
|
||||
QueryOptions: structs.QueryOptions{Region: "global"},
|
||||
}
|
||||
var getResp structs.SingleJobResponse
|
||||
@@ -425,10 +425,10 @@ func TestHTTP_JobDelete(t *testing.T) {
|
||||
func TestHTTP_JobForceEvaluate(t *testing.T) {
|
||||
httpTest(t, nil, func(s *TestServer) {
|
||||
// Create the job
|
||||
job := api.MockJob()
|
||||
args := api.JobRegisterRequest{
|
||||
job := mock.Job()
|
||||
args := structs.JobRegisterRequest{
|
||||
Job: job,
|
||||
WriteRequest: api.WriteRequest{Region: "global"},
|
||||
WriteRequest: structs.WriteRequest{Region: "global"},
|
||||
}
|
||||
var resp structs.JobRegisterResponse
|
||||
if err := s.Agent.RPC("Job.Register", &args, &resp); err != nil {
|
||||
@@ -436,7 +436,7 @@ func TestHTTP_JobForceEvaluate(t *testing.T) {
|
||||
}
|
||||
|
||||
// Make the HTTP request
|
||||
req, err := http.NewRequest("POST", "/v1/job/"+*job.ID+"/evaluate", nil)
|
||||
req, err := http.NewRequest("POST", "/v1/job/"+job.ID+"/evaluate", nil)
|
||||
if err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
@@ -464,10 +464,10 @@ func TestHTTP_JobForceEvaluate(t *testing.T) {
|
||||
func TestHTTP_JobEvaluations(t *testing.T) {
|
||||
httpTest(t, nil, func(s *TestServer) {
|
||||
// Create the job
|
||||
job := api.MockJob()
|
||||
args := api.JobRegisterRequest{
|
||||
job := mock.Job()
|
||||
args := structs.JobRegisterRequest{
|
||||
Job: job,
|
||||
WriteRequest: api.WriteRequest{Region: "global"},
|
||||
WriteRequest: structs.WriteRequest{Region: "global"},
|
||||
}
|
||||
var resp structs.JobRegisterResponse
|
||||
if err := s.Agent.RPC("Job.Register", &args, &resp); err != nil {
|
||||
@@ -475,7 +475,7 @@ func TestHTTP_JobEvaluations(t *testing.T) {
|
||||
}
|
||||
|
||||
// Make the HTTP request
|
||||
req, err := http.NewRequest("GET", "/v1/job/"+*job.ID+"/evaluations", nil)
|
||||
req, err := http.NewRequest("GET", "/v1/job/"+job.ID+"/evaluations", nil)
|
||||
if err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
@@ -563,10 +563,10 @@ func TestHTTP_JobAllocations(t *testing.T) {
|
||||
func TestHTTP_PeriodicForce(t *testing.T) {
|
||||
httpTest(t, nil, func(s *TestServer) {
|
||||
// Create and register a periodic job.
|
||||
job := api.MockPeriodicJob()
|
||||
args := api.JobRegisterRequest{
|
||||
job := mock.PeriodicJob()
|
||||
args := structs.JobRegisterRequest{
|
||||
Job: job,
|
||||
WriteRequest: api.WriteRequest{Region: "global"},
|
||||
WriteRequest: structs.WriteRequest{Region: "global"},
|
||||
}
|
||||
var resp structs.JobRegisterResponse
|
||||
if err := s.Agent.RPC("Job.Register", &args, &resp); err != nil {
|
||||
@@ -574,7 +574,7 @@ func TestHTTP_PeriodicForce(t *testing.T) {
|
||||
}
|
||||
|
||||
// Make the HTTP request
|
||||
req, err := http.NewRequest("POST", "/v1/job/"+*job.ID+"/periodic/force", nil)
|
||||
req, err := http.NewRequest("POST", "/v1/job/"+job.ID+"/periodic/force", nil)
|
||||
if err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
@@ -638,13 +638,13 @@ func TestHTTP_JobPlan(t *testing.T) {
|
||||
func TestHTTP_JobDispatch(t *testing.T) {
|
||||
httpTest(t, nil, func(s *TestServer) {
|
||||
// Create the parameterized job
|
||||
job := api.MockJob()
|
||||
job.Type = helper.StringToPtr("batch")
|
||||
job.ParameterizedJob = &api.ParameterizedJobConfig{}
|
||||
job := mock.Job()
|
||||
job.Type = "batch"
|
||||
job.ParameterizedJob = &structs.ParameterizedJobConfig{}
|
||||
|
||||
args := api.JobRegisterRequest{
|
||||
args := structs.JobRegisterRequest{
|
||||
Job: job,
|
||||
WriteRequest: api.WriteRequest{Region: "global"},
|
||||
WriteRequest: structs.WriteRequest{Region: "global"},
|
||||
}
|
||||
var resp structs.JobRegisterResponse
|
||||
if err := s.Agent.RPC("Job.Register", &args, &resp); err != nil {
|
||||
@@ -659,7 +659,7 @@ func TestHTTP_JobDispatch(t *testing.T) {
|
||||
buf := encodeReq(args2)
|
||||
|
||||
// Make the HTTP request
|
||||
req2, err := http.NewRequest("PUT", "/v1/job/"+*job.ID+"/dispatch", buf)
|
||||
req2, err := http.NewRequest("PUT", "/v1/job/"+job.ID+"/dispatch", buf)
|
||||
if err != nil {
|
||||
t.Fatalf("err: %v", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user