Thanks go vet!

This commit is contained in:
Michael Schurter 2017-04-19 13:05:41 -07:00
parent a1eaa6cea1
commit 83f9591d75
3 changed files with 5 additions and 4 deletions

View File

@ -55,7 +55,7 @@ func newMockConsulServiceClient() *mockConsulServiceClient {
func (m *mockConsulServiceClient) UpdateTask(allocID string, old, new *structs.Task, exec driver.ScriptExecutor) error {
m.mu.Lock()
defer m.mu.Unlock()
m.logger.Printf("[TEST] mock_consul: UpdateTask(%q, %q, %q, %T)", allocID, old, new, exec)
m.logger.Printf("[TEST] mock_consul: UpdateTask(%q, %v, %v, %T)", allocID, old, new, exec)
m.ops = append(m.ops, newMockConsulOp("update", allocID, old, exec))
return nil
}

View File

@ -96,6 +96,7 @@ func (s *scriptCheck) run() *scriptHandle {
switch execctx.Err() {
case context.Canceled:
// check removed during execution; exit
cancel()
return
case context.DeadlineExceeded:
metrics.IncrCounter([]string{"client", "consul", "script_timeouts"}, 1)

View File

@ -119,7 +119,7 @@ func TestConsulScript_Exec_Timeout(t *testing.T) {
select {
case update := <-hb.updates:
if update.status != api.HealthCritical {
t.Error("expected %q due to timeout but received %q", api.HealthCritical, update)
t.Errorf("expected %q due to timeout but received %q", api.HealthCritical, update)
}
case <-time.After(3 * time.Second):
t.Fatalf("timed out waiting for script check to exit")
@ -167,7 +167,7 @@ func TestConsulScript_Exec_TimeoutCritical(t *testing.T) {
select {
case update := <-hb.updates:
if update.status != api.HealthCritical {
t.Error("expected %q due to timeout but received %q", api.HealthCritical, update)
t.Errorf("expected %q due to timeout but received %q", api.HealthCritical, update)
}
if update.output != context.DeadlineExceeded.Error() {
t.Errorf("expected output=%q but found: %q", context.DeadlineExceeded.Error(), update.output)
@ -214,7 +214,7 @@ func TestConsulScript_Exec_Shutdown(t *testing.T) {
select {
case update := <-hb.updates:
if update.status != api.HealthPassing {
t.Error("expected %q due to timeout but received %q", api.HealthCritical, update)
t.Errorf("expected %q due to timeout but received %q", api.HealthCritical, update)
}
case <-time.After(3 * time.Second):
t.Fatalf("timed out waiting for script check to exit")