Merge pull request #11827 from hashicorp/cleanup-response-recorder
cleanup: stop referencing depreceted HeaderMap field
This commit is contained in:
commit
2f5057d085
|
@ -50,7 +50,7 @@ func (r *ResponseRecorder) Header() http.Header {
|
|||
func (r *ResponseRecorder) HeaderMap() http.Header {
|
||||
r.mu.Lock()
|
||||
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.
|
||||
|
|
|
@ -44,13 +44,13 @@ func TestHTTP_ACLPolicyList(t *testing.T) {
|
|||
}
|
||||
|
||||
// Check for the index
|
||||
if respW.HeaderMap.Get("X-Nomad-Index") == "" {
|
||||
if respW.Result().Header.Get("X-Nomad-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")
|
||||
}
|
||||
if respW.HeaderMap.Get("X-Nomad-LastContact") == "" {
|
||||
if respW.Result().Header.Get("X-Nomad-LastContact") == "" {
|
||||
t.Fatalf("missing last contact")
|
||||
}
|
||||
|
||||
|
@ -93,13 +93,13 @@ func TestHTTP_ACLPolicyQuery(t *testing.T) {
|
|||
}
|
||||
|
||||
// Check for the index
|
||||
if respW.HeaderMap.Get("X-Nomad-Index") == "" {
|
||||
if respW.Result().Header.Get("X-Nomad-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")
|
||||
}
|
||||
if respW.HeaderMap.Get("X-Nomad-LastContact") == "" {
|
||||
if respW.Result().Header.Get("X-Nomad-LastContact") == "" {
|
||||
t.Fatalf("missing last contact")
|
||||
}
|
||||
|
||||
|
@ -130,7 +130,7 @@ func TestHTTP_ACLPolicyCreate(t *testing.T) {
|
|||
assert.Nil(t, obj)
|
||||
|
||||
// Check for the index
|
||||
if respW.HeaderMap.Get("X-Nomad-Index") == "" {
|
||||
if respW.Result().Header.Get("X-Nomad-Index") == "" {
|
||||
t.Fatalf("missing index")
|
||||
}
|
||||
|
||||
|
@ -176,7 +176,7 @@ func TestHTTP_ACLPolicyDelete(t *testing.T) {
|
|||
assert.Nil(t, obj)
|
||||
|
||||
// Check for the index
|
||||
if respW.HeaderMap.Get("X-Nomad-Index") == "" {
|
||||
if respW.Result().Header.Get("X-Nomad-Index") == "" {
|
||||
t.Fatalf("missing index")
|
||||
}
|
||||
|
||||
|
@ -209,7 +209,7 @@ func TestHTTP_ACLTokenBootstrap(t *testing.T) {
|
|||
}
|
||||
|
||||
// Check for the index
|
||||
if respW.HeaderMap.Get("X-Nomad-Index") == "" {
|
||||
if respW.Result().Header.Get("X-Nomad-Index") == "" {
|
||||
t.Fatalf("missing index")
|
||||
}
|
||||
|
||||
|
@ -256,13 +256,13 @@ func TestHTTP_ACLTokenList(t *testing.T) {
|
|||
}
|
||||
|
||||
// Check for the index
|
||||
if respW.HeaderMap.Get("X-Nomad-Index") == "" {
|
||||
if respW.Result().Header.Get("X-Nomad-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")
|
||||
}
|
||||
if respW.HeaderMap.Get("X-Nomad-LastContact") == "" {
|
||||
if respW.Result().Header.Get("X-Nomad-LastContact") == "" {
|
||||
t.Fatalf("missing last contact")
|
||||
}
|
||||
|
||||
|
@ -307,13 +307,13 @@ func TestHTTP_ACLTokenQuery(t *testing.T) {
|
|||
}
|
||||
|
||||
// Check for the index
|
||||
if respW.HeaderMap.Get("X-Nomad-Index") == "" {
|
||||
if respW.Result().Header.Get("X-Nomad-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")
|
||||
}
|
||||
if respW.HeaderMap.Get("X-Nomad-LastContact") == "" {
|
||||
if respW.Result().Header.Get("X-Nomad-LastContact") == "" {
|
||||
t.Fatalf("missing last contact")
|
||||
}
|
||||
|
||||
|
@ -356,13 +356,13 @@ func TestHTTP_ACLTokenSelf(t *testing.T) {
|
|||
}
|
||||
|
||||
// Check for the index
|
||||
if respW.HeaderMap.Get("X-Nomad-Index") == "" {
|
||||
if respW.Result().Header.Get("X-Nomad-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")
|
||||
}
|
||||
if respW.HeaderMap.Get("X-Nomad-LastContact") == "" {
|
||||
if respW.Result().Header.Get("X-Nomad-LastContact") == "" {
|
||||
t.Fatalf("missing last contact")
|
||||
}
|
||||
|
||||
|
@ -393,7 +393,7 @@ func TestHTTP_ACLTokenCreate(t *testing.T) {
|
|||
outTK := obj.(*structs.ACLToken)
|
||||
|
||||
// Check for the index
|
||||
if respW.HeaderMap.Get("X-Nomad-Index") == "" {
|
||||
if respW.Result().Header.Get("X-Nomad-Index") == "" {
|
||||
t.Fatalf("missing index")
|
||||
}
|
||||
|
||||
|
@ -438,7 +438,7 @@ func TestHTTP_ACLTokenDelete(t *testing.T) {
|
|||
assert.Nil(t, obj)
|
||||
|
||||
// Check for the index
|
||||
if respW.HeaderMap.Get("X-Nomad-Index") == "" {
|
||||
if respW.Result().Header.Get("X-Nomad-Index") == "" {
|
||||
t.Fatalf("missing index")
|
||||
}
|
||||
|
||||
|
|
|
@ -62,13 +62,13 @@ func TestHTTP_AllocsList(t *testing.T) {
|
|||
}
|
||||
|
||||
// Check for the index
|
||||
if respW.HeaderMap.Get("X-Nomad-Index") == "" {
|
||||
if respW.Result().Header.Get("X-Nomad-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")
|
||||
}
|
||||
if respW.HeaderMap.Get("X-Nomad-LastContact") == "" {
|
||||
if respW.Result().Header.Get("X-Nomad-LastContact") == "" {
|
||||
t.Fatalf("missing last contact")
|
||||
}
|
||||
|
||||
|
@ -129,13 +129,13 @@ func TestHTTP_AllocsPrefixList(t *testing.T) {
|
|||
}
|
||||
|
||||
// Check for the index
|
||||
if respW.HeaderMap.Get("X-Nomad-Index") == "" {
|
||||
if respW.Result().Header.Get("X-Nomad-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")
|
||||
}
|
||||
if respW.HeaderMap.Get("X-Nomad-LastContact") == "" {
|
||||
if respW.Result().Header.Get("X-Nomad-LastContact") == "" {
|
||||
t.Fatalf("missing last contact")
|
||||
}
|
||||
|
||||
|
@ -231,13 +231,13 @@ func TestHTTP_AllocQuery_Payload(t *testing.T) {
|
|||
}
|
||||
|
||||
// Check for the index
|
||||
if respW.HeaderMap.Get("X-Nomad-Index") == "" {
|
||||
if respW.Result().Header.Get("X-Nomad-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")
|
||||
}
|
||||
if respW.HeaderMap.Get("X-Nomad-LastContact") == "" {
|
||||
if respW.Result().Header.Get("X-Nomad-LastContact") == "" {
|
||||
t.Fatalf("missing last contact")
|
||||
}
|
||||
|
||||
|
|
|
@ -31,9 +31,9 @@ func TestHTTP_DeploymentList(t *testing.T) {
|
|||
assert.Nil(err, "Deployment Request")
|
||||
|
||||
// Check for the index
|
||||
assert.NotZero(respW.HeaderMap.Get("X-Nomad-Index"), "missing index")
|
||||
assert.Equal("true", respW.HeaderMap.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-Index"), "missing index")
|
||||
assert.Equal("true", respW.Result().Header.Get("X-Nomad-KnownLeader"), "missing known leader")
|
||||
assert.NotZero(respW.Result().Header.Get("X-Nomad-LastContact"), "missing last contact")
|
||||
|
||||
// Check the deployments
|
||||
deploys := obj.([]*structs.Deployment)
|
||||
|
@ -64,9 +64,9 @@ func TestHTTP_DeploymentPrefixList(t *testing.T) {
|
|||
assert.Nil(err, "Deployment Request")
|
||||
|
||||
// Check for the index
|
||||
assert.NotZero(respW.HeaderMap.Get("X-Nomad-Index"), "missing index")
|
||||
assert.Equal("true", respW.HeaderMap.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-Index"), "missing index")
|
||||
assert.Equal("true", respW.Result().Header.Get("X-Nomad-KnownLeader"), "missing known leader")
|
||||
assert.NotZero(respW.Result().Header.Get("X-Nomad-LastContact"), "missing last contact")
|
||||
|
||||
// Check the deployments
|
||||
deploys := obj.([]*structs.Deployment)
|
||||
|
@ -121,9 +121,9 @@ func TestHTTP_DeploymentAllocations(t *testing.T) {
|
|||
assert.Nil(err, "DeploymentSpecificRequest")
|
||||
|
||||
// Check for the index
|
||||
assert.NotZero(respW.HeaderMap.Get("X-Nomad-Index"), "missing index")
|
||||
assert.Equal("true", respW.HeaderMap.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-Index"), "missing index")
|
||||
assert.Equal("true", respW.Result().Header.Get("X-Nomad-KnownLeader"), "missing known leader")
|
||||
assert.NotZero(respW.Result().Header.Get("X-Nomad-LastContact"), "missing last contact")
|
||||
|
||||
// Check the output
|
||||
allocs := obj.([]*structs.AllocListStub)
|
||||
|
@ -155,9 +155,9 @@ func TestHTTP_DeploymentQuery(t *testing.T) {
|
|||
assert.Nil(err, "Deployment Request")
|
||||
|
||||
// Check for the index
|
||||
assert.NotZero(respW.HeaderMap.Get("X-Nomad-Index"), "missing index")
|
||||
assert.Equal("true", respW.HeaderMap.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-Index"), "missing index")
|
||||
assert.Equal("true", respW.Result().Header.Get("X-Nomad-KnownLeader"), "missing known leader")
|
||||
assert.NotZero(respW.Result().Header.Get("X-Nomad-LastContact"), "missing last contact")
|
||||
|
||||
// Check the job
|
||||
out := obj.(*structs.Deployment)
|
||||
|
@ -202,7 +202,7 @@ func TestHTTP_DeploymentPause(t *testing.T) {
|
|||
assert.NotZero(resp.EvalID, "Expect Eval")
|
||||
assert.NotZero(resp.EvalCreateIndex, "Expect Eval")
|
||||
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) {
|
|||
assert.NotZero(resp.EvalID, "Expect Eval")
|
||||
assert.NotZero(resp.EvalCreateIndex, "Expect Eval")
|
||||
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) {
|
|||
assert.NotZero(resp.EvalID, "Expect Eval")
|
||||
assert.NotZero(resp.EvalCreateIndex, "Expect Eval")
|
||||
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) {
|
|||
assert.NotZero(resp.EvalID, "Expect Eval")
|
||||
assert.NotZero(resp.EvalCreateIndex, "Expect Eval")
|
||||
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) {
|
|||
require.NoError(t, err)
|
||||
|
||||
// check headers and response body
|
||||
require.NotEqual(t, "", respW.HeaderMap.Get("X-Nomad-Index"), "missing index")
|
||||
require.Equal(t, "true", respW.HeaderMap.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-Index"), "missing index")
|
||||
require.Equal(t, "true", respW.Result().Header.Get("X-Nomad-KnownLeader"), "missing known leader")
|
||||
require.NotEqual(t, "", respW.Result().Header.Get("X-Nomad-LastContact"), "missing last contact")
|
||||
require.Len(t, obj.([]*structs.Evaluation), 2, "expected 2 evals")
|
||||
|
||||
// paginated list request
|
||||
|
@ -87,13 +87,13 @@ func TestHTTP_EvalPrefixList(t *testing.T) {
|
|||
}
|
||||
|
||||
// Check for the index
|
||||
if respW.HeaderMap.Get("X-Nomad-Index") == "" {
|
||||
if respW.Result().Header.Get("X-Nomad-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")
|
||||
}
|
||||
if respW.HeaderMap.Get("X-Nomad-LastContact") == "" {
|
||||
if respW.Result().Header.Get("X-Nomad-LastContact") == "" {
|
||||
t.Fatalf("missing last contact")
|
||||
}
|
||||
|
||||
|
@ -140,13 +140,13 @@ func TestHTTP_EvalAllocations(t *testing.T) {
|
|||
}
|
||||
|
||||
// Check for the index
|
||||
if respW.HeaderMap.Get("X-Nomad-Index") == "" {
|
||||
if respW.Result().Header.Get("X-Nomad-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")
|
||||
}
|
||||
if respW.HeaderMap.Get("X-Nomad-LastContact") == "" {
|
||||
if respW.Result().Header.Get("X-Nomad-LastContact") == "" {
|
||||
t.Fatalf("missing last contact")
|
||||
}
|
||||
|
||||
|
@ -183,13 +183,13 @@ func TestHTTP_EvalQuery(t *testing.T) {
|
|||
}
|
||||
|
||||
// Check for the index
|
||||
if respW.HeaderMap.Get("X-Nomad-Index") == "" {
|
||||
if respW.Result().Header.Get("X-Nomad-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")
|
||||
}
|
||||
if respW.HeaderMap.Get("X-Nomad-LastContact") == "" {
|
||||
if respW.Result().Header.Get("X-Nomad-LastContact") == "" {
|
||||
t.Fatalf("missing last contact")
|
||||
}
|
||||
|
||||
|
|
|
@ -51,13 +51,13 @@ func TestHTTP_JobsList(t *testing.T) {
|
|||
}
|
||||
|
||||
// Check for the index
|
||||
if respW.HeaderMap.Get("X-Nomad-Index") == "" {
|
||||
if respW.Result().Header.Get("X-Nomad-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")
|
||||
}
|
||||
if respW.HeaderMap.Get("X-Nomad-LastContact") == "" {
|
||||
if respW.Result().Header.Get("X-Nomad-LastContact") == "" {
|
||||
t.Fatalf("missing last contact")
|
||||
}
|
||||
|
||||
|
@ -109,13 +109,13 @@ func TestHTTP_PrefixJobsList(t *testing.T) {
|
|||
}
|
||||
|
||||
// Check for the index
|
||||
if respW.HeaderMap.Get("X-Nomad-Index") == "" {
|
||||
if respW.Result().Header.Get("X-Nomad-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")
|
||||
}
|
||||
if respW.HeaderMap.Get("X-Nomad-LastContact") == "" {
|
||||
if respW.Result().Header.Get("X-Nomad-LastContact") == "" {
|
||||
t.Fatalf("missing last contact")
|
||||
}
|
||||
|
||||
|
@ -155,9 +155,9 @@ func TestHTTP_JobsList_AllNamespaces_OSS(t *testing.T) {
|
|||
require.NoError(t, err)
|
||||
|
||||
// Check for the index
|
||||
require.NotEmpty(t, respW.HeaderMap.Get("X-Nomad-Index"), "missing index")
|
||||
require.Equal(t, "true", respW.HeaderMap.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-Index"), "missing index")
|
||||
require.Equal(t, "true", respW.Result().Header.Get("X-Nomad-KnownLeader"), "missing known leader")
|
||||
require.NotEmpty(t, respW.Result().Header.Get("X-Nomad-LastContact"), "missing last contact")
|
||||
|
||||
// Check the job
|
||||
j := obj.([]*structs.JobListStub)
|
||||
|
@ -198,7 +198,7 @@ func TestHTTP_JobsRegister(t *testing.T) {
|
|||
}
|
||||
|
||||
// Check for the index
|
||||
if respW.HeaderMap.Get("X-Nomad-Index") == "" {
|
||||
if respW.Result().Header.Get("X-Nomad-Index") == "" {
|
||||
t.Fatalf("missing index")
|
||||
}
|
||||
|
||||
|
@ -248,7 +248,7 @@ func TestHTTP_JobsRegister_IgnoresParentID(t *testing.T) {
|
|||
require.NotEmpty(t, reg.EvalID)
|
||||
|
||||
// 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
|
||||
getReq := structs.JobSpecificRequest{
|
||||
|
@ -349,7 +349,7 @@ func TestHTTP_JobsRegister_Defaulting(t *testing.T) {
|
|||
}
|
||||
|
||||
// Check for the index
|
||||
if respW.HeaderMap.Get("X-Nomad-Index") == "" {
|
||||
if respW.Result().Header.Get("X-Nomad-Index") == "" {
|
||||
t.Fatalf("missing index")
|
||||
}
|
||||
|
||||
|
@ -438,13 +438,13 @@ func TestHTTP_JobQuery(t *testing.T) {
|
|||
}
|
||||
|
||||
// Check for the index
|
||||
if respW.HeaderMap.Get("X-Nomad-Index") == "" {
|
||||
if respW.Result().Header.Get("X-Nomad-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")
|
||||
}
|
||||
if respW.HeaderMap.Get("X-Nomad-LastContact") == "" {
|
||||
if respW.Result().Header.Get("X-Nomad-LastContact") == "" {
|
||||
t.Fatalf("missing last contact")
|
||||
}
|
||||
|
||||
|
@ -487,13 +487,13 @@ func TestHTTP_JobQuery_Payload(t *testing.T) {
|
|||
}
|
||||
|
||||
// Check for the index
|
||||
if respW.HeaderMap.Get("X-Nomad-Index") == "" {
|
||||
if respW.Result().Header.Get("X-Nomad-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")
|
||||
}
|
||||
if respW.HeaderMap.Get("X-Nomad-LastContact") == "" {
|
||||
if respW.Result().Header.Get("X-Nomad-LastContact") == "" {
|
||||
t.Fatalf("missing last contact")
|
||||
}
|
||||
|
||||
|
@ -574,7 +574,7 @@ func TestHTTP_JobUpdate(t *testing.T) {
|
|||
}
|
||||
|
||||
// Check for the index
|
||||
if respW.HeaderMap.Get("X-Nomad-Index") == "" {
|
||||
if respW.Result().Header.Get("X-Nomad-Index") == "" {
|
||||
t.Fatalf("missing index")
|
||||
}
|
||||
|
||||
|
@ -771,7 +771,7 @@ func TestHTTP_JobUpdateRegion(t *testing.T) {
|
|||
require.NotEmpty(t, dereg.EvalID)
|
||||
|
||||
// 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
|
||||
getReq := structs.JobSpecificRequest{
|
||||
|
@ -828,7 +828,7 @@ func TestHTTP_JobDelete(t *testing.T) {
|
|||
}
|
||||
|
||||
// Check for the index
|
||||
if respW.HeaderMap.Get("X-Nomad-Index") == "" {
|
||||
if respW.Result().Header.Get("X-Nomad-Index") == "" {
|
||||
t.Fatalf("missing index")
|
||||
}
|
||||
|
||||
|
@ -871,7 +871,7 @@ func TestHTTP_JobDelete(t *testing.T) {
|
|||
}
|
||||
|
||||
// Check for the index
|
||||
if respW.HeaderMap.Get("X-Nomad-Index") == "" {
|
||||
if respW.Result().Header.Get("X-Nomad-Index") == "" {
|
||||
t.Fatalf("missing index")
|
||||
}
|
||||
|
||||
|
@ -1141,7 +1141,7 @@ func TestHTTP_JobForceEvaluate(t *testing.T) {
|
|||
}
|
||||
|
||||
// Check for the index
|
||||
if respW.HeaderMap.Get("X-Nomad-Index") == "" {
|
||||
if respW.Result().Header.Get("X-Nomad-Index") == "" {
|
||||
t.Fatalf("missing index")
|
||||
}
|
||||
})
|
||||
|
@ -1192,7 +1192,7 @@ func TestHTTP_JobEvaluate_ForceReschedule(t *testing.T) {
|
|||
}
|
||||
|
||||
// Check for the index
|
||||
if respW.HeaderMap.Get("X-Nomad-Index") == "" {
|
||||
if respW.Result().Header.Get("X-Nomad-Index") == "" {
|
||||
t.Fatalf("missing index")
|
||||
}
|
||||
})
|
||||
|
@ -1237,13 +1237,13 @@ func TestHTTP_JobEvaluations(t *testing.T) {
|
|||
}
|
||||
|
||||
// Check for the index
|
||||
if respW.HeaderMap.Get("X-Nomad-Index") == "" {
|
||||
if respW.Result().Header.Get("X-Nomad-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")
|
||||
}
|
||||
if respW.HeaderMap.Get("X-Nomad-LastContact") == "" {
|
||||
if respW.Result().Header.Get("X-Nomad-LastContact") == "" {
|
||||
t.Fatalf("missing last contact")
|
||||
}
|
||||
})
|
||||
|
@ -1302,13 +1302,13 @@ func TestHTTP_JobAllocations(t *testing.T) {
|
|||
assert.Equal(t, expectedDisplayMsg, displayMsg)
|
||||
|
||||
// Check for the index
|
||||
if respW.HeaderMap.Get("X-Nomad-Index") == "" {
|
||||
if respW.Result().Header.Get("X-Nomad-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")
|
||||
}
|
||||
if respW.HeaderMap.Get("X-Nomad-LastContact") == "" {
|
||||
if respW.Result().Header.Get("X-Nomad-LastContact") == "" {
|
||||
t.Fatalf("missing last contact")
|
||||
}
|
||||
})
|
||||
|
@ -1352,9 +1352,9 @@ func TestHTTP_JobDeployments(t *testing.T) {
|
|||
assert.Len(deploys, 1, "deployments")
|
||||
assert.Equal(d.ID, deploys[0].ID, "deployment id")
|
||||
|
||||
assert.NotZero(respW.HeaderMap.Get("X-Nomad-Index"), "missing index")
|
||||
assert.Equal("true", respW.HeaderMap.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-Index"), "missing index")
|
||||
assert.Equal("true", respW.Result().Header.Get("X-Nomad-KnownLeader"), "missing known leader")
|
||||
assert.NotZero(respW.Result().Header.Get("X-Nomad-LastContact"), "missing last contact")
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -1395,9 +1395,9 @@ func TestHTTP_JobDeployment(t *testing.T) {
|
|||
assert.NotNil(out, "deployment")
|
||||
assert.Equal(d.ID, out.ID, "deployment id")
|
||||
|
||||
assert.NotZero(respW.HeaderMap.Get("X-Nomad-Index"), "missing index")
|
||||
assert.Equal("true", respW.HeaderMap.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-Index"), "missing index")
|
||||
assert.Equal("true", respW.Result().Header.Get("X-Nomad-KnownLeader"), "missing known leader")
|
||||
assert.NotZero(respW.Result().Header.Get("X-Nomad-LastContact"), "missing last contact")
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -1467,13 +1467,13 @@ func TestHTTP_JobVersions(t *testing.T) {
|
|||
}
|
||||
|
||||
// Check for the index
|
||||
if respW.HeaderMap.Get("X-Nomad-Index") == "" {
|
||||
if respW.Result().Header.Get("X-Nomad-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")
|
||||
}
|
||||
if respW.HeaderMap.Get("X-Nomad-LastContact") == "" {
|
||||
if respW.Result().Header.Get("X-Nomad-LastContact") == "" {
|
||||
t.Fatalf("missing last contact")
|
||||
}
|
||||
})
|
||||
|
@ -1510,7 +1510,7 @@ func TestHTTP_PeriodicForce(t *testing.T) {
|
|||
}
|
||||
|
||||
// Check for the index
|
||||
if respW.HeaderMap.Get("X-Nomad-Index") == "" {
|
||||
if respW.Result().Header.Get("X-Nomad-Index") == "" {
|
||||
t.Fatalf("missing index")
|
||||
}
|
||||
|
||||
|
@ -1745,7 +1745,7 @@ func TestHTTP_JobRevert(t *testing.T) {
|
|||
}
|
||||
|
||||
// Check for the index
|
||||
if respW.HeaderMap.Get("X-Nomad-Index") == "" {
|
||||
if respW.Result().Header.Get("X-Nomad-Index") == "" {
|
||||
t.Fatalf("missing index")
|
||||
}
|
||||
})
|
||||
|
@ -1803,7 +1803,7 @@ func TestHTTP_JobStable(t *testing.T) {
|
|||
}
|
||||
|
||||
// Check for the index
|
||||
if respW.HeaderMap.Get("X-Nomad-Index") == "" {
|
||||
if respW.Result().Header.Get("X-Nomad-Index") == "" {
|
||||
t.Fatalf("missing index")
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue