Skip to content

Commit

Permalink
No service matching task id, change log level to warning.
Browse files Browse the repository at this point in the history
  • Loading branch information
tomez committed Apr 11, 2017
1 parent 96dab08 commit 2a9b403
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion consul/consul.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,10 @@ func (c *Consul) DeregisterByTask(taskID apps.TaskID) error {
if err != nil {
return err
} else if len(services) == 0 {
return fmt.Errorf("Couldn't find any service matching task id %s", taskID)
log.WithFields(
log.Fields{"Id": taskID},
).Warningf("Couldn't find any service matching task id")
return nil
}
return c.deregisterMultipleServices(services, taskID)
}
Expand Down
4 changes: 2 additions & 2 deletions consul/consul_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ func TestDeregisterServicesByTask_shouldReturnErrorOnFailure(t *testing.T) {
assert.Error(t, err)
}

func TestDeregisterServicesByTask_shouldReturnErrorOnServiceMatchingTaskNotFound(t *testing.T) {
func TestDeregisterServicesByTask_shouldReturnNilErrorOnServiceMatchingTaskNotFound(t *testing.T) {
t.Parallel()
server := CreateTestServer(t)
defer server.Stop()
Expand All @@ -639,7 +639,7 @@ func TestDeregisterServicesByTask_shouldReturnErrorOnServiceMatchingTaskNotFound
err := consul.DeregisterByTask("non-existing")

// then
assert.Error(t, err)
assert.NoError(t, err)
services, _ = consul.GetAllServices()
assert.Len(t, services, 2)
}
Expand Down

0 comments on commit 2a9b403

Please sign in to comment.