Commit 4b20581d authored by Seth Hoenig's avatar Seth Hoenig
Browse files

cleanup: stop referencing depreceted HeaderMap field

Remove reference to the deprecated ResponseRecorder.HeaderMap field,
instead calling .Response.Header() to get the same data.

closes #10520
parent 1b719eef
Showing with 100 additions and 100 deletions
+100 -100
...@@ -50,7 +50,7 @@ func (r *ResponseRecorder) Header() http.Header { ...@@ -50,7 +50,7 @@ func (r *ResponseRecorder) Header() http.Header {
func (r *ResponseRecorder) HeaderMap() http.Header { func (r *ResponseRecorder) HeaderMap() http.Header {
r.mu.Lock() r.mu.Lock()
defer r.mu.Unlock() defer r.mu.Unlock()
return r.rr.HeaderMap return r.rr.Result().Header
} }
// Write to the underlying response buffer. Safe to call concurrent with Read. // Write to the underlying response buffer. Safe to call concurrent with Read.
......
...@@ -44,13 +44,13 @@ func TestHTTP_ACLPolicyList(t *testing.T) { ...@@ -44,13 +44,13 @@ func TestHTTP_ACLPolicyList(t *testing.T) {
} }
// Check for the index // Check for the index
if respW.HeaderMap.Get("X-Nomad-Index") == "" { if respW.Result().Header.Get("X-Nomad-Index") == "" {
t.Fatalf("missing index") t.Fatalf("missing index")
} }
if respW.HeaderMap.Get("X-Nomad-KnownLeader") != "true" { if respW.Result().Header.Get("X-Nomad-KnownLeader") != "true" {
t.Fatalf("missing known leader") t.Fatalf("missing known leader")
} }
if respW.HeaderMap.Get("X-Nomad-LastContact") == "" { if respW.Result().Header.Get("X-Nomad-LastContact") == "" {
t.Fatalf("missing last contact") t.Fatalf("missing last contact")
} }
...@@ -93,13 +93,13 @@ func TestHTTP_ACLPolicyQuery(t *testing.T) { ...@@ -93,13 +93,13 @@ func TestHTTP_ACLPolicyQuery(t *testing.T) {
} }
// Check for the index // Check for the index
if respW.HeaderMap.Get("X-Nomad-Index") == "" { if respW.Result().Header.Get("X-Nomad-Index") == "" {
t.Fatalf("missing index") t.Fatalf("missing index")
} }
if respW.HeaderMap.Get("X-Nomad-KnownLeader") != "true" { if respW.Result().Header.Get("X-Nomad-KnownLeader") != "true" {
t.Fatalf("missing known leader") t.Fatalf("missing known leader")
} }
if respW.HeaderMap.Get("X-Nomad-LastContact") == "" { if respW.Result().Header.Get("X-Nomad-LastContact") == "" {
t.Fatalf("missing last contact") t.Fatalf("missing last contact")
} }
...@@ -130,7 +130,7 @@ func TestHTTP_ACLPolicyCreate(t *testing.T) { ...@@ -130,7 +130,7 @@ func TestHTTP_ACLPolicyCreate(t *testing.T) {
assert.Nil(t, obj) assert.Nil(t, obj)
// Check for the index // Check for the index
if respW.HeaderMap.Get("X-Nomad-Index") == "" { if respW.Result().Header.Get("X-Nomad-Index") == "" {
t.Fatalf("missing index") t.Fatalf("missing index")
} }
...@@ -176,7 +176,7 @@ func TestHTTP_ACLPolicyDelete(t *testing.T) { ...@@ -176,7 +176,7 @@ func TestHTTP_ACLPolicyDelete(t *testing.T) {
assert.Nil(t, obj) assert.Nil(t, obj)
// Check for the index // Check for the index
if respW.HeaderMap.Get("X-Nomad-Index") == "" { if respW.Result().Header.Get("X-Nomad-Index") == "" {
t.Fatalf("missing index") t.Fatalf("missing index")
} }
...@@ -209,7 +209,7 @@ func TestHTTP_ACLTokenBootstrap(t *testing.T) { ...@@ -209,7 +209,7 @@ func TestHTTP_ACLTokenBootstrap(t *testing.T) {
} }
// Check for the index // Check for the index
if respW.HeaderMap.Get("X-Nomad-Index") == "" { if respW.Result().Header.Get("X-Nomad-Index") == "" {
t.Fatalf("missing index") t.Fatalf("missing index")
} }
...@@ -256,13 +256,13 @@ func TestHTTP_ACLTokenList(t *testing.T) { ...@@ -256,13 +256,13 @@ func TestHTTP_ACLTokenList(t *testing.T) {
} }
// Check for the index // Check for the index
if respW.HeaderMap.Get("X-Nomad-Index") == "" { if respW.Result().Header.Get("X-Nomad-Index") == "" {
t.Fatalf("missing index") t.Fatalf("missing index")
} }
if respW.HeaderMap.Get("X-Nomad-KnownLeader") != "true" { if respW.Result().Header.Get("X-Nomad-KnownLeader") != "true" {
t.Fatalf("missing known leader") t.Fatalf("missing known leader")
} }
if respW.HeaderMap.Get("X-Nomad-LastContact") == "" { if respW.Result().Header.Get("X-Nomad-LastContact") == "" {
t.Fatalf("missing last contact") t.Fatalf("missing last contact")
} }
...@@ -307,13 +307,13 @@ func TestHTTP_ACLTokenQuery(t *testing.T) { ...@@ -307,13 +307,13 @@ func TestHTTP_ACLTokenQuery(t *testing.T) {
} }
// Check for the index // Check for the index
if respW.HeaderMap.Get("X-Nomad-Index") == "" { if respW.Result().Header.Get("X-Nomad-Index") == "" {
t.Fatalf("missing index") t.Fatalf("missing index")
} }
if respW.HeaderMap.Get("X-Nomad-KnownLeader") != "true" { if respW.Result().Header.Get("X-Nomad-KnownLeader") != "true" {
t.Fatalf("missing known leader") t.Fatalf("missing known leader")
} }
if respW.HeaderMap.Get("X-Nomad-LastContact") == "" { if respW.Result().Header.Get("X-Nomad-LastContact") == "" {
t.Fatalf("missing last contact") t.Fatalf("missing last contact")
} }
...@@ -356,13 +356,13 @@ func TestHTTP_ACLTokenSelf(t *testing.T) { ...@@ -356,13 +356,13 @@ func TestHTTP_ACLTokenSelf(t *testing.T) {
} }
// Check for the index // Check for the index
if respW.HeaderMap.Get("X-Nomad-Index") == "" { if respW.Result().Header.Get("X-Nomad-Index") == "" {
t.Fatalf("missing index") t.Fatalf("missing index")
} }
if respW.HeaderMap.Get("X-Nomad-KnownLeader") != "true" { if respW.Result().Header.Get("X-Nomad-KnownLeader") != "true" {
t.Fatalf("missing known leader") t.Fatalf("missing known leader")
} }
if respW.HeaderMap.Get("X-Nomad-LastContact") == "" { if respW.Result().Header.Get("X-Nomad-LastContact") == "" {
t.Fatalf("missing last contact") t.Fatalf("missing last contact")
} }
...@@ -393,7 +393,7 @@ func TestHTTP_ACLTokenCreate(t *testing.T) { ...@@ -393,7 +393,7 @@ func TestHTTP_ACLTokenCreate(t *testing.T) {
outTK := obj.(*structs.ACLToken) outTK := obj.(*structs.ACLToken)
// Check for the index // Check for the index
if respW.HeaderMap.Get("X-Nomad-Index") == "" { if respW.Result().Header.Get("X-Nomad-Index") == "" {
t.Fatalf("missing index") t.Fatalf("missing index")
} }
...@@ -438,7 +438,7 @@ func TestHTTP_ACLTokenDelete(t *testing.T) { ...@@ -438,7 +438,7 @@ func TestHTTP_ACLTokenDelete(t *testing.T) {
assert.Nil(t, obj) assert.Nil(t, obj)
// Check for the index // Check for the index
if respW.HeaderMap.Get("X-Nomad-Index") == "" { if respW.Result().Header.Get("X-Nomad-Index") == "" {
t.Fatalf("missing index") t.Fatalf("missing index")
} }
......
...@@ -62,13 +62,13 @@ func TestHTTP_AllocsList(t *testing.T) { ...@@ -62,13 +62,13 @@ func TestHTTP_AllocsList(t *testing.T) {
} }
// Check for the index // Check for the index
if respW.HeaderMap.Get("X-Nomad-Index") == "" { if respW.Result().Header.Get("X-Nomad-Index") == "" {
t.Fatalf("missing index") t.Fatalf("missing index")
} }
if respW.HeaderMap.Get("X-Nomad-KnownLeader") != "true" { if respW.Result().Header.Get("X-Nomad-KnownLeader") != "true" {
t.Fatalf("missing known leader") t.Fatalf("missing known leader")
} }
if respW.HeaderMap.Get("X-Nomad-LastContact") == "" { if respW.Result().Header.Get("X-Nomad-LastContact") == "" {
t.Fatalf("missing last contact") t.Fatalf("missing last contact")
} }
...@@ -129,13 +129,13 @@ func TestHTTP_AllocsPrefixList(t *testing.T) { ...@@ -129,13 +129,13 @@ func TestHTTP_AllocsPrefixList(t *testing.T) {
} }
// Check for the index // Check for the index
if respW.HeaderMap.Get("X-Nomad-Index") == "" { if respW.Result().Header.Get("X-Nomad-Index") == "" {
t.Fatalf("missing index") t.Fatalf("missing index")
} }
if respW.HeaderMap.Get("X-Nomad-KnownLeader") != "true" { if respW.Result().Header.Get("X-Nomad-KnownLeader") != "true" {
t.Fatalf("missing known leader") t.Fatalf("missing known leader")
} }
if respW.HeaderMap.Get("X-Nomad-LastContact") == "" { if respW.Result().Header.Get("X-Nomad-LastContact") == "" {
t.Fatalf("missing last contact") t.Fatalf("missing last contact")
} }
...@@ -231,13 +231,13 @@ func TestHTTP_AllocQuery_Payload(t *testing.T) { ...@@ -231,13 +231,13 @@ func TestHTTP_AllocQuery_Payload(t *testing.T) {
} }
// Check for the index // Check for the index
if respW.HeaderMap.Get("X-Nomad-Index") == "" { if respW.Result().Header.Get("X-Nomad-Index") == "" {
t.Fatalf("missing index") t.Fatalf("missing index")
} }
if respW.HeaderMap.Get("X-Nomad-KnownLeader") != "true" { if respW.Result().Header.Get("X-Nomad-KnownLeader") != "true" {
t.Fatalf("missing known leader") t.Fatalf("missing known leader")
} }
if respW.HeaderMap.Get("X-Nomad-LastContact") == "" { if respW.Result().Header.Get("X-Nomad-LastContact") == "" {
t.Fatalf("missing last contact") t.Fatalf("missing last contact")
} }
......
...@@ -31,9 +31,9 @@ func TestHTTP_DeploymentList(t *testing.T) { ...@@ -31,9 +31,9 @@ func TestHTTP_DeploymentList(t *testing.T) {
assert.Nil(err, "Deployment Request") assert.Nil(err, "Deployment Request")
// Check for the index // Check for the index
assert.NotZero(respW.HeaderMap.Get("X-Nomad-Index"), "missing index") assert.NotZero(respW.Result().Header.Get("X-Nomad-Index"), "missing index")
assert.Equal("true", respW.HeaderMap.Get("X-Nomad-KnownLeader"), "missing known leader") assert.Equal("true", respW.Result().Header.Get("X-Nomad-KnownLeader"), "missing known leader")
assert.NotZero(respW.HeaderMap.Get("X-Nomad-LastContact"), "missing last contact") assert.NotZero(respW.Result().Header.Get("X-Nomad-LastContact"), "missing last contact")
// Check the deployments // Check the deployments
deploys := obj.([]*structs.Deployment) deploys := obj.([]*structs.Deployment)
...@@ -64,9 +64,9 @@ func TestHTTP_DeploymentPrefixList(t *testing.T) { ...@@ -64,9 +64,9 @@ func TestHTTP_DeploymentPrefixList(t *testing.T) {
assert.Nil(err, "Deployment Request") assert.Nil(err, "Deployment Request")
// Check for the index // Check for the index
assert.NotZero(respW.HeaderMap.Get("X-Nomad-Index"), "missing index") assert.NotZero(respW.Result().Header.Get("X-Nomad-Index"), "missing index")
assert.Equal("true", respW.HeaderMap.Get("X-Nomad-KnownLeader"), "missing known leader") assert.Equal("true", respW.Result().Header.Get("X-Nomad-KnownLeader"), "missing known leader")
assert.NotZero(respW.HeaderMap.Get("X-Nomad-LastContact"), "missing last contact") assert.NotZero(respW.Result().Header.Get("X-Nomad-LastContact"), "missing last contact")
// Check the deployments // Check the deployments
deploys := obj.([]*structs.Deployment) deploys := obj.([]*structs.Deployment)
...@@ -121,9 +121,9 @@ func TestHTTP_DeploymentAllocations(t *testing.T) { ...@@ -121,9 +121,9 @@ func TestHTTP_DeploymentAllocations(t *testing.T) {
assert.Nil(err, "DeploymentSpecificRequest") assert.Nil(err, "DeploymentSpecificRequest")
// Check for the index // Check for the index
assert.NotZero(respW.HeaderMap.Get("X-Nomad-Index"), "missing index") assert.NotZero(respW.Result().Header.Get("X-Nomad-Index"), "missing index")
assert.Equal("true", respW.HeaderMap.Get("X-Nomad-KnownLeader"), "missing known leader") assert.Equal("true", respW.Result().Header.Get("X-Nomad-KnownLeader"), "missing known leader")
assert.NotZero(respW.HeaderMap.Get("X-Nomad-LastContact"), "missing last contact") assert.NotZero(respW.Result().Header.Get("X-Nomad-LastContact"), "missing last contact")
// Check the output // Check the output
allocs := obj.([]*structs.AllocListStub) allocs := obj.([]*structs.AllocListStub)
...@@ -155,9 +155,9 @@ func TestHTTP_DeploymentQuery(t *testing.T) { ...@@ -155,9 +155,9 @@ func TestHTTP_DeploymentQuery(t *testing.T) {
assert.Nil(err, "Deployment Request") assert.Nil(err, "Deployment Request")
// Check for the index // Check for the index
assert.NotZero(respW.HeaderMap.Get("X-Nomad-Index"), "missing index") assert.NotZero(respW.Result().Header.Get("X-Nomad-Index"), "missing index")
assert.Equal("true", respW.HeaderMap.Get("X-Nomad-KnownLeader"), "missing known leader") assert.Equal("true", respW.Result().Header.Get("X-Nomad-KnownLeader"), "missing known leader")
assert.NotZero(respW.HeaderMap.Get("X-Nomad-LastContact"), "missing last contact") assert.NotZero(respW.Result().Header.Get("X-Nomad-LastContact"), "missing last contact")
// Check the job // Check the job
out := obj.(*structs.Deployment) out := obj.(*structs.Deployment)
...@@ -202,7 +202,7 @@ func TestHTTP_DeploymentPause(t *testing.T) { ...@@ -202,7 +202,7 @@ func TestHTTP_DeploymentPause(t *testing.T) {
assert.NotZero(resp.EvalID, "Expect Eval") assert.NotZero(resp.EvalID, "Expect Eval")
assert.NotZero(resp.EvalCreateIndex, "Expect Eval") assert.NotZero(resp.EvalCreateIndex, "Expect Eval")
assert.NotZero(resp.DeploymentModifyIndex, "Expect Deployment to be Modified") assert.NotZero(resp.DeploymentModifyIndex, "Expect Deployment to be Modified")
assert.NotZero(respW.HeaderMap.Get("X-Nomad-Index"), "missing index") assert.NotZero(respW.Result().Header.Get("X-Nomad-Index"), "missing index")
}) })
} }
...@@ -243,7 +243,7 @@ func TestHTTP_DeploymentPromote(t *testing.T) { ...@@ -243,7 +243,7 @@ func TestHTTP_DeploymentPromote(t *testing.T) {
assert.NotZero(resp.EvalID, "Expect Eval") assert.NotZero(resp.EvalID, "Expect Eval")
assert.NotZero(resp.EvalCreateIndex, "Expect Eval") assert.NotZero(resp.EvalCreateIndex, "Expect Eval")
assert.NotZero(resp.DeploymentModifyIndex, "Expect Deployment to be Modified") assert.NotZero(resp.DeploymentModifyIndex, "Expect Deployment to be Modified")
assert.NotZero(respW.HeaderMap.Get("X-Nomad-Index"), "missing index") assert.NotZero(respW.Result().Header.Get("X-Nomad-Index"), "missing index")
}) })
} }
...@@ -288,7 +288,7 @@ func TestHTTP_DeploymentAllocHealth(t *testing.T) { ...@@ -288,7 +288,7 @@ func TestHTTP_DeploymentAllocHealth(t *testing.T) {
assert.NotZero(resp.EvalID, "Expect Eval") assert.NotZero(resp.EvalID, "Expect Eval")
assert.NotZero(resp.EvalCreateIndex, "Expect Eval") assert.NotZero(resp.EvalCreateIndex, "Expect Eval")
assert.NotZero(resp.DeploymentModifyIndex, "Expect Deployment to be Modified") assert.NotZero(resp.DeploymentModifyIndex, "Expect Deployment to be Modified")
assert.NotZero(respW.HeaderMap.Get("X-Nomad-Index"), "missing index") assert.NotZero(respW.Result().Header.Get("X-Nomad-Index"), "missing index")
}) })
} }
...@@ -318,6 +318,6 @@ func TestHTTP_DeploymentFail(t *testing.T) { ...@@ -318,6 +318,6 @@ func TestHTTP_DeploymentFail(t *testing.T) {
assert.NotZero(resp.EvalID, "Expect Eval") assert.NotZero(resp.EvalID, "Expect Eval")
assert.NotZero(resp.EvalCreateIndex, "Expect Eval") assert.NotZero(resp.EvalCreateIndex, "Expect Eval")
assert.NotZero(resp.DeploymentModifyIndex, "Expect Deployment to be Modified") assert.NotZero(resp.DeploymentModifyIndex, "Expect Deployment to be Modified")
assert.NotZero(respW.HeaderMap.Get("X-Nomad-Index"), "missing index") assert.NotZero(respW.Result().Header.Get("X-Nomad-Index"), "missing index")
}) })
} }
...@@ -30,9 +30,9 @@ func TestHTTP_EvalList(t *testing.T) { ...@@ -30,9 +30,9 @@ func TestHTTP_EvalList(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
// check headers and response body // check headers and response body
require.NotEqual(t, "", respW.HeaderMap.Get("X-Nomad-Index"), "missing index") require.NotEqual(t, "", respW.Result().Header.Get("X-Nomad-Index"), "missing index")
require.Equal(t, "true", respW.HeaderMap.Get("X-Nomad-KnownLeader"), "missing known leader") require.Equal(t, "true", respW.Result().Header.Get("X-Nomad-KnownLeader"), "missing known leader")
require.NotEqual(t, "", respW.HeaderMap.Get("X-Nomad-LastContact"), "missing last contact") require.NotEqual(t, "", respW.Result().Header.Get("X-Nomad-LastContact"), "missing last contact")
require.Len(t, obj.([]*structs.Evaluation), 2, "expected 2 evals") require.Len(t, obj.([]*structs.Evaluation), 2, "expected 2 evals")
// paginated list request // paginated list request
...@@ -87,13 +87,13 @@ func TestHTTP_EvalPrefixList(t *testing.T) { ...@@ -87,13 +87,13 @@ func TestHTTP_EvalPrefixList(t *testing.T) {
} }
// Check for the index // Check for the index
if respW.HeaderMap.Get("X-Nomad-Index") == "" { if respW.Result().Header.Get("X-Nomad-Index") == "" {
t.Fatalf("missing index") t.Fatalf("missing index")
} }
if respW.HeaderMap.Get("X-Nomad-KnownLeader") != "true" { if respW.Result().Header.Get("X-Nomad-KnownLeader") != "true" {
t.Fatalf("missing known leader") t.Fatalf("missing known leader")
} }
if respW.HeaderMap.Get("X-Nomad-LastContact") == "" { if respW.Result().Header.Get("X-Nomad-LastContact") == "" {
t.Fatalf("missing last contact") t.Fatalf("missing last contact")
} }
...@@ -140,13 +140,13 @@ func TestHTTP_EvalAllocations(t *testing.T) { ...@@ -140,13 +140,13 @@ func TestHTTP_EvalAllocations(t *testing.T) {
} }
// Check for the index // Check for the index
if respW.HeaderMap.Get("X-Nomad-Index") == "" { if respW.Result().Header.Get("X-Nomad-Index") == "" {
t.Fatalf("missing index") t.Fatalf("missing index")
} }
if respW.HeaderMap.Get("X-Nomad-KnownLeader") != "true" { if respW.Result().Header.Get("X-Nomad-KnownLeader") != "true" {
t.Fatalf("missing known leader") t.Fatalf("missing known leader")
} }
if respW.HeaderMap.Get("X-Nomad-LastContact") == "" { if respW.Result().Header.Get("X-Nomad-LastContact") == "" {
t.Fatalf("missing last contact") t.Fatalf("missing last contact")
} }
...@@ -183,13 +183,13 @@ func TestHTTP_EvalQuery(t *testing.T) { ...@@ -183,13 +183,13 @@ func TestHTTP_EvalQuery(t *testing.T) {
} }
// Check for the index // Check for the index
if respW.HeaderMap.Get("X-Nomad-Index") == "" { if respW.Result().Header.Get("X-Nomad-Index") == "" {
t.Fatalf("missing index") t.Fatalf("missing index")
} }
if respW.HeaderMap.Get("X-Nomad-KnownLeader") != "true" { if respW.Result().Header.Get("X-Nomad-KnownLeader") != "true" {
t.Fatalf("missing known leader") t.Fatalf("missing known leader")
} }
if respW.HeaderMap.Get("X-Nomad-LastContact") == "" { if respW.Result().Header.Get("X-Nomad-LastContact") == "" {
t.Fatalf("missing last contact") t.Fatalf("missing last contact")
} }
......
...@@ -51,13 +51,13 @@ func TestHTTP_JobsList(t *testing.T) { ...@@ -51,13 +51,13 @@ func TestHTTP_JobsList(t *testing.T) {
} }
// Check for the index // Check for the index
if respW.HeaderMap.Get("X-Nomad-Index") == "" { if respW.Result().Header.Get("X-Nomad-Index") == "" {
t.Fatalf("missing index") t.Fatalf("missing index")
} }
if respW.HeaderMap.Get("X-Nomad-KnownLeader") != "true" { if respW.Result().Header.Get("X-Nomad-KnownLeader") != "true" {
t.Fatalf("missing known leader") t.Fatalf("missing known leader")
} }
if respW.HeaderMap.Get("X-Nomad-LastContact") == "" { if respW.Result().Header.Get("X-Nomad-LastContact") == "" {
t.Fatalf("missing last contact") t.Fatalf("missing last contact")
} }
...@@ -109,13 +109,13 @@ func TestHTTP_PrefixJobsList(t *testing.T) { ...@@ -109,13 +109,13 @@ func TestHTTP_PrefixJobsList(t *testing.T) {
} }
// Check for the index // Check for the index
if respW.HeaderMap.Get("X-Nomad-Index") == "" { if respW.Result().Header.Get("X-Nomad-Index") == "" {
t.Fatalf("missing index") t.Fatalf("missing index")
} }
if respW.HeaderMap.Get("X-Nomad-KnownLeader") != "true" { if respW.Result().Header.Get("X-Nomad-KnownLeader") != "true" {
t.Fatalf("missing known leader") t.Fatalf("missing known leader")
} }
if respW.HeaderMap.Get("X-Nomad-LastContact") == "" { if respW.Result().Header.Get("X-Nomad-LastContact") == "" {
t.Fatalf("missing last contact") t.Fatalf("missing last contact")
} }
...@@ -155,9 +155,9 @@ func TestHTTP_JobsList_AllNamespaces_OSS(t *testing.T) { ...@@ -155,9 +155,9 @@ func TestHTTP_JobsList_AllNamespaces_OSS(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
// Check for the index // Check for the index
require.NotEmpty(t, respW.HeaderMap.Get("X-Nomad-Index"), "missing index") require.NotEmpty(t, respW.Result().Header.Get("X-Nomad-Index"), "missing index")
require.Equal(t, "true", respW.HeaderMap.Get("X-Nomad-KnownLeader"), "missing known leader") require.Equal(t, "true", respW.Result().Header.Get("X-Nomad-KnownLeader"), "missing known leader")
require.NotEmpty(t, respW.HeaderMap.Get("X-Nomad-LastContact"), "missing last contact") require.NotEmpty(t, respW.Result().Header.Get("X-Nomad-LastContact"), "missing last contact")
// Check the job // Check the job
j := obj.([]*structs.JobListStub) j := obj.([]*structs.JobListStub)
...@@ -198,7 +198,7 @@ func TestHTTP_JobsRegister(t *testing.T) { ...@@ -198,7 +198,7 @@ func TestHTTP_JobsRegister(t *testing.T) {
} }
// Check for the index // Check for the index
if respW.HeaderMap.Get("X-Nomad-Index") == "" { if respW.Result().Header.Get("X-Nomad-Index") == "" {
t.Fatalf("missing index") t.Fatalf("missing index")
} }
...@@ -248,7 +248,7 @@ func TestHTTP_JobsRegister_IgnoresParentID(t *testing.T) { ...@@ -248,7 +248,7 @@ func TestHTTP_JobsRegister_IgnoresParentID(t *testing.T) {
require.NotEmpty(t, reg.EvalID) require.NotEmpty(t, reg.EvalID)
// Check for the index // Check for the index
require.NotEmpty(t, respW.HeaderMap.Get("X-Nomad-Index")) require.NotEmpty(t, respW.Result().Header.Get("X-Nomad-Index"))
// Check the job is registered // Check the job is registered
getReq := structs.JobSpecificRequest{ getReq := structs.JobSpecificRequest{
...@@ -349,7 +349,7 @@ func TestHTTP_JobsRegister_Defaulting(t *testing.T) { ...@@ -349,7 +349,7 @@ func TestHTTP_JobsRegister_Defaulting(t *testing.T) {
} }
// Check for the index // Check for the index
if respW.HeaderMap.Get("X-Nomad-Index") == "" { if respW.Result().Header.Get("X-Nomad-Index") == "" {
t.Fatalf("missing index") t.Fatalf("missing index")
} }
...@@ -438,13 +438,13 @@ func TestHTTP_JobQuery(t *testing.T) { ...@@ -438,13 +438,13 @@ func TestHTTP_JobQuery(t *testing.T) {
} }
// Check for the index // Check for the index
if respW.HeaderMap.Get("X-Nomad-Index") == "" { if respW.Result().Header.Get("X-Nomad-Index") == "" {
t.Fatalf("missing index") t.Fatalf("missing index")
} }
if respW.HeaderMap.Get("X-Nomad-KnownLeader") != "true" { if respW.Result().Header.Get("X-Nomad-KnownLeader") != "true" {
t.Fatalf("missing known leader") t.Fatalf("missing known leader")
} }
if respW.HeaderMap.Get("X-Nomad-LastContact") == "" { if respW.Result().Header.Get("X-Nomad-LastContact") == "" {
t.Fatalf("missing last contact") t.Fatalf("missing last contact")
} }
...@@ -487,13 +487,13 @@ func TestHTTP_JobQuery_Payload(t *testing.T) { ...@@ -487,13 +487,13 @@ func TestHTTP_JobQuery_Payload(t *testing.T) {
} }
// Check for the index // Check for the index
if respW.HeaderMap.Get("X-Nomad-Index") == "" { if respW.Result().Header.Get("X-Nomad-Index") == "" {
t.Fatalf("missing index") t.Fatalf("missing index")
} }
if respW.HeaderMap.Get("X-Nomad-KnownLeader") != "true" { if respW.Result().Header.Get("X-Nomad-KnownLeader") != "true" {
t.Fatalf("missing known leader") t.Fatalf("missing known leader")
} }
if respW.HeaderMap.Get("X-Nomad-LastContact") == "" { if respW.Result().Header.Get("X-Nomad-LastContact") == "" {
t.Fatalf("missing last contact") t.Fatalf("missing last contact")
} }
...@@ -574,7 +574,7 @@ func TestHTTP_JobUpdate(t *testing.T) { ...@@ -574,7 +574,7 @@ func TestHTTP_JobUpdate(t *testing.T) {
} }
// Check for the index // Check for the index
if respW.HeaderMap.Get("X-Nomad-Index") == "" { if respW.Result().Header.Get("X-Nomad-Index") == "" {
t.Fatalf("missing index") t.Fatalf("missing index")
} }
...@@ -771,7 +771,7 @@ func TestHTTP_JobUpdateRegion(t *testing.T) { ...@@ -771,7 +771,7 @@ func TestHTTP_JobUpdateRegion(t *testing.T) {
require.NotEmpty(t, dereg.EvalID) require.NotEmpty(t, dereg.EvalID)
// Check for the index // Check for the index
require.NotEmpty(t, respW.HeaderMap.Get("X-Nomad-Index"), "missing index") require.NotEmpty(t, respW.Result().Header.Get("X-Nomad-Index"), "missing index")
// Check the job is registered // Check the job is registered
getReq := structs.JobSpecificRequest{ getReq := structs.JobSpecificRequest{
...@@ -828,7 +828,7 @@ func TestHTTP_JobDelete(t *testing.T) { ...@@ -828,7 +828,7 @@ func TestHTTP_JobDelete(t *testing.T) {
} }
// Check for the index // Check for the index
if respW.HeaderMap.Get("X-Nomad-Index") == "" { if respW.Result().Header.Get("X-Nomad-Index") == "" {
t.Fatalf("missing index") t.Fatalf("missing index")
} }
...@@ -871,7 +871,7 @@ func TestHTTP_JobDelete(t *testing.T) { ...@@ -871,7 +871,7 @@ func TestHTTP_JobDelete(t *testing.T) {
} }
// Check for the index // Check for the index
if respW.HeaderMap.Get("X-Nomad-Index") == "" { if respW.Result().Header.Get("X-Nomad-Index") == "" {
t.Fatalf("missing index") t.Fatalf("missing index")
} }
...@@ -1141,7 +1141,7 @@ func TestHTTP_JobForceEvaluate(t *testing.T) { ...@@ -1141,7 +1141,7 @@ func TestHTTP_JobForceEvaluate(t *testing.T) {
} }
// Check for the index // Check for the index
if respW.HeaderMap.Get("X-Nomad-Index") == "" { if respW.Result().Header.Get("X-Nomad-Index") == "" {
t.Fatalf("missing index") t.Fatalf("missing index")
} }
}) })
...@@ -1192,7 +1192,7 @@ func TestHTTP_JobEvaluate_ForceReschedule(t *testing.T) { ...@@ -1192,7 +1192,7 @@ func TestHTTP_JobEvaluate_ForceReschedule(t *testing.T) {
} }
// Check for the index // Check for the index
if respW.HeaderMap.Get("X-Nomad-Index") == "" { if respW.Result().Header.Get("X-Nomad-Index") == "" {
t.Fatalf("missing index") t.Fatalf("missing index")
} }
}) })
...@@ -1237,13 +1237,13 @@ func TestHTTP_JobEvaluations(t *testing.T) { ...@@ -1237,13 +1237,13 @@ func TestHTTP_JobEvaluations(t *testing.T) {
} }
// Check for the index // Check for the index
if respW.HeaderMap.Get("X-Nomad-Index") == "" { if respW.Result().Header.Get("X-Nomad-Index") == "" {
t.Fatalf("missing index") t.Fatalf("missing index")
} }
if respW.HeaderMap.Get("X-Nomad-KnownLeader") != "true" { if respW.Result().Header.Get("X-Nomad-KnownLeader") != "true" {
t.Fatalf("missing known leader") t.Fatalf("missing known leader")
} }
if respW.HeaderMap.Get("X-Nomad-LastContact") == "" { if respW.Result().Header.Get("X-Nomad-LastContact") == "" {
t.Fatalf("missing last contact") t.Fatalf("missing last contact")
} }
}) })
...@@ -1302,13 +1302,13 @@ func TestHTTP_JobAllocations(t *testing.T) { ...@@ -1302,13 +1302,13 @@ func TestHTTP_JobAllocations(t *testing.T) {
assert.Equal(t, expectedDisplayMsg, displayMsg) assert.Equal(t, expectedDisplayMsg, displayMsg)
// Check for the index // Check for the index
if respW.HeaderMap.Get("X-Nomad-Index") == "" { if respW.Result().Header.Get("X-Nomad-Index") == "" {
t.Fatalf("missing index") t.Fatalf("missing index")
} }
if respW.HeaderMap.Get("X-Nomad-KnownLeader") != "true" { if respW.Result().Header.Get("X-Nomad-KnownLeader") != "true" {
t.Fatalf("missing known leader") t.Fatalf("missing known leader")
} }
if respW.HeaderMap.Get("X-Nomad-LastContact") == "" { if respW.Result().Header.Get("X-Nomad-LastContact") == "" {
t.Fatalf("missing last contact") t.Fatalf("missing last contact")
} }
}) })
...@@ -1352,9 +1352,9 @@ func TestHTTP_JobDeployments(t *testing.T) { ...@@ -1352,9 +1352,9 @@ func TestHTTP_JobDeployments(t *testing.T) {
assert.Len(deploys, 1, "deployments") assert.Len(deploys, 1, "deployments")
assert.Equal(d.ID, deploys[0].ID, "deployment id") assert.Equal(d.ID, deploys[0].ID, "deployment id")
assert.NotZero(respW.HeaderMap.Get("X-Nomad-Index"), "missing index") assert.NotZero(respW.Result().Header.Get("X-Nomad-Index"), "missing index")
assert.Equal("true", respW.HeaderMap.Get("X-Nomad-KnownLeader"), "missing known leader") assert.Equal("true", respW.Result().Header.Get("X-Nomad-KnownLeader"), "missing known leader")
assert.NotZero(respW.HeaderMap.Get("X-Nomad-LastContact"), "missing last contact") assert.NotZero(respW.Result().Header.Get("X-Nomad-LastContact"), "missing last contact")
}) })
} }
...@@ -1395,9 +1395,9 @@ func TestHTTP_JobDeployment(t *testing.T) { ...@@ -1395,9 +1395,9 @@ func TestHTTP_JobDeployment(t *testing.T) {
assert.NotNil(out, "deployment") assert.NotNil(out, "deployment")
assert.Equal(d.ID, out.ID, "deployment id") assert.Equal(d.ID, out.ID, "deployment id")
assert.NotZero(respW.HeaderMap.Get("X-Nomad-Index"), "missing index") assert.NotZero(respW.Result().Header.Get("X-Nomad-Index"), "missing index")
assert.Equal("true", respW.HeaderMap.Get("X-Nomad-KnownLeader"), "missing known leader") assert.Equal("true", respW.Result().Header.Get("X-Nomad-KnownLeader"), "missing known leader")
assert.NotZero(respW.HeaderMap.Get("X-Nomad-LastContact"), "missing last contact") assert.NotZero(respW.Result().Header.Get("X-Nomad-LastContact"), "missing last contact")
}) })
} }
...@@ -1467,13 +1467,13 @@ func TestHTTP_JobVersions(t *testing.T) { ...@@ -1467,13 +1467,13 @@ func TestHTTP_JobVersions(t *testing.T) {
} }
// Check for the index // Check for the index
if respW.HeaderMap.Get("X-Nomad-Index") == "" { if respW.Result().Header.Get("X-Nomad-Index") == "" {
t.Fatalf("missing index") t.Fatalf("missing index")
} }
if respW.HeaderMap.Get("X-Nomad-KnownLeader") != "true" { if respW.Result().Header.Get("X-Nomad-KnownLeader") != "true" {
t.Fatalf("missing known leader") t.Fatalf("missing known leader")
} }
if respW.HeaderMap.Get("X-Nomad-LastContact") == "" { if respW.Result().Header.Get("X-Nomad-LastContact") == "" {
t.Fatalf("missing last contact") t.Fatalf("missing last contact")
} }
}) })
...@@ -1510,7 +1510,7 @@ func TestHTTP_PeriodicForce(t *testing.T) { ...@@ -1510,7 +1510,7 @@ func TestHTTP_PeriodicForce(t *testing.T) {
} }
// Check for the index // Check for the index
if respW.HeaderMap.Get("X-Nomad-Index") == "" { if respW.Result().Header.Get("X-Nomad-Index") == "" {
t.Fatalf("missing index") t.Fatalf("missing index")
} }
...@@ -1745,7 +1745,7 @@ func TestHTTP_JobRevert(t *testing.T) { ...@@ -1745,7 +1745,7 @@ func TestHTTP_JobRevert(t *testing.T) {
} }
// Check for the index // Check for the index
if respW.HeaderMap.Get("X-Nomad-Index") == "" { if respW.Result().Header.Get("X-Nomad-Index") == "" {
t.Fatalf("missing index") t.Fatalf("missing index")
} }
}) })
...@@ -1803,7 +1803,7 @@ func TestHTTP_JobStable(t *testing.T) { ...@@ -1803,7 +1803,7 @@ func TestHTTP_JobStable(t *testing.T) {
} }
// Check for the index // Check for the index
if respW.HeaderMap.Get("X-Nomad-Index") == "" { if respW.Result().Header.Get("X-Nomad-Index") == "" {
t.Fatalf("missing index") t.Fatalf("missing index")
} }
}) })
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment