mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 18:35:44 +03:00
feedback and rebasing
This commit is contained in:
@@ -164,7 +164,7 @@ func (s *HTTPServer) allocGC(allocID string, resp http.ResponseWriter, req *http
|
||||
}
|
||||
|
||||
if rpcErr != nil {
|
||||
if structs.IsErrNoNodeConn(rpcErr) || strings.Contains(rpcErr.Error(), "unknown allocation") {
|
||||
if structs.IsErrNoNodeConn(rpcErr) || structs.IsErrUnknownAllocation(rpcErr) {
|
||||
rpcErr = CodedError(404, rpcErr.Error())
|
||||
}
|
||||
}
|
||||
@@ -216,7 +216,7 @@ func (s *HTTPServer) allocStats(allocID string, resp http.ResponseWriter, req *h
|
||||
}
|
||||
|
||||
if rpcErr != nil {
|
||||
if structs.IsErrNoNodeConn(rpcErr) || strings.Contains(rpcErr.Error(), "unknown allocation") {
|
||||
if structs.IsErrNoNodeConn(rpcErr) || structs.IsErrUnknownAllocation(rpcErr) {
|
||||
rpcErr = CodedError(404, rpcErr.Error())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -277,7 +277,7 @@ func TestHTTP_AllocStats(t *testing.T) {
|
||||
// Make the request
|
||||
_, err = s.Server.ClientAllocRequest(respW, req)
|
||||
require.NotNil(err)
|
||||
require.Contains(err.Error(), "unknown allocation")
|
||||
require.True(structs.IsErrUnknownAllocation(err))
|
||||
}
|
||||
|
||||
// Local node, server resp
|
||||
@@ -291,7 +291,7 @@ func TestHTTP_AllocStats(t *testing.T) {
|
||||
respW := httptest.NewRecorder()
|
||||
_, err = s.Server.ClientAllocRequest(respW, req)
|
||||
require.NotNil(err)
|
||||
require.Contains(err.Error(), "unknown allocation")
|
||||
require.True(structs.IsErrUnknownAllocation(err))
|
||||
|
||||
s.server = srv
|
||||
}
|
||||
@@ -317,7 +317,7 @@ func TestHTTP_AllocStats(t *testing.T) {
|
||||
respW := httptest.NewRecorder()
|
||||
_, err = s.Server.ClientAllocRequest(respW, req)
|
||||
require.NotNil(err)
|
||||
require.Contains(err.Error(), "unknown allocation")
|
||||
require.True(structs.IsErrUnknownAllocation(err))
|
||||
|
||||
s.client = c
|
||||
}
|
||||
@@ -551,7 +551,7 @@ func TestHTTP_AllocGC(t *testing.T) {
|
||||
|
||||
respW := httptest.NewRecorder()
|
||||
_, err = s.Server.ClientAllocRequest(respW, req)
|
||||
if err == nil || !strings.Contains(err.Error(), "unknown allocation") {
|
||||
if !structs.IsErrUnknownAllocation(err) {
|
||||
t.Fatalf("unexpected err: %v", err)
|
||||
}
|
||||
}
|
||||
@@ -568,7 +568,7 @@ func TestHTTP_AllocGC(t *testing.T) {
|
||||
|
||||
respW := httptest.NewRecorder()
|
||||
_, err = s.Server.ClientAllocRequest(respW, req)
|
||||
if err == nil || !strings.Contains(err.Error(), "unknown allocation") {
|
||||
if !structs.IsErrUnknownAllocation(err) {
|
||||
t.Fatalf("unexpected err: %v", err)
|
||||
}
|
||||
|
||||
@@ -598,7 +598,7 @@ func TestHTTP_AllocGC(t *testing.T) {
|
||||
respW := httptest.NewRecorder()
|
||||
_, err = s.Server.ClientAllocRequest(respW, req)
|
||||
require.NotNil(err)
|
||||
if err == nil || !strings.Contains(err.Error(), "unknown allocation") {
|
||||
if !structs.IsErrUnknownAllocation(err) {
|
||||
t.Fatalf("unexpected err: %v", err)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user