mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 18:35:44 +03:00
Small fixes
This commit: * Fixes the error checking in migration tests now that we are using the canonical ErrPermissionDenied error * Guard against NPE when looking up objects to generate the migration token * Handle an additional case in ShouldMigrate()
This commit is contained in:
@@ -342,7 +342,7 @@ func TestHTTP_AllocSnapshot_WithMigrateToken(t *testing.T) {
|
||||
respW := httptest.NewRecorder()
|
||||
_, err = s.Server.ClientAllocRequest(respW, req)
|
||||
assert.NotNil(err)
|
||||
assert.Contains(err.Error(), "invalid migrate token")
|
||||
assert.EqualError(err, structs.ErrPermissionDenied.Error())
|
||||
|
||||
// Create an allocation
|
||||
alloc := mock.Alloc()
|
||||
@@ -360,7 +360,7 @@ func TestHTTP_AllocSnapshot_WithMigrateToken(t *testing.T) {
|
||||
// Make the unauthorized request
|
||||
respW = httptest.NewRecorder()
|
||||
_, err = s.Server.ClientAllocRequest(respW, req)
|
||||
assert.NotContains(err.Error(), "invalid migrate token")
|
||||
assert.NotContains(err.Error(), structs.ErrPermissionDenied.Error())
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user