Skip to content

Commit

Permalink
fix go test complaints
Browse files Browse the repository at this point in the history
  • Loading branch information
gulducat committed Mar 10, 2025
1 parent 832a578 commit 29e0d3a
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 19 deletions.
6 changes: 3 additions & 3 deletions client/allocrunner/checks_hook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ func TestCheckHook_Checks_ResultsSet(t *testing.T) {
return true, nil
},
func(err error) {
t.Fatalf(err.Error())
t.Fatal(err)
},
)

Expand Down Expand Up @@ -271,7 +271,7 @@ func TestCheckHook_Checks_UpdateSet(t *testing.T) {
return true, nil
},
func(err error) {
t.Fatalf(err.Error())
t.Fatal(err)
},
)

Expand Down Expand Up @@ -308,7 +308,7 @@ func TestCheckHook_Checks_UpdateSet(t *testing.T) {
return true, nil
},
func(err error) {
t.Fatalf(err.Error())
t.Fatal(err)
},
)

Expand Down
4 changes: 2 additions & 2 deletions client/allocrunner/taskrunner/task_runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2047,10 +2047,10 @@ func TestTaskRunner_DriverNetwork(t *testing.T) {
}, func(err error) {
services, _ := consulAgent.ServicesWithFilterOpts("", nil)
for _, s := range services {
t.Logf(pretty.Sprint("Service: ", s))
t.Log(pretty.Sprint("Service: ", s))
}
for _, c := range consulAgent.CheckRegs() {
t.Logf(pretty.Sprint("Check: ", c))
t.Log(pretty.Sprint("Check: ", c))
}
require.NoError(t, err)
})
Expand Down
12 changes: 6 additions & 6 deletions client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ func TestClient_MixedTLS(t *testing.T) {
return true, nil
},
func(err error) {
t.Fatalf(err.Error())
t.Fatal(err)
},
)
}
Expand Down Expand Up @@ -414,7 +414,7 @@ func TestClient_BadTLS(t *testing.T) {
return true, nil
},
func(err error) {
t.Fatalf(err.Error())
t.Fatal(err)
},
)
}
Expand Down Expand Up @@ -1271,7 +1271,7 @@ func TestClient_ReloadTLS_UpgradePlaintextToTLS(t *testing.T) {
return true, nil
},
func(err error) {
t.Fatalf(err.Error())
t.Fatal(err)
},
)
}
Expand Down Expand Up @@ -1304,7 +1304,7 @@ func TestClient_ReloadTLS_UpgradePlaintextToTLS(t *testing.T) {
return true, nil
},
func(err error) {
t.Fatalf(err.Error())
t.Fatal(err)
},
)
}
Expand Down Expand Up @@ -1357,7 +1357,7 @@ func TestClient_ReloadTLS_DowngradeTLSToPlaintext(t *testing.T) {
}
return true, nil
}, func(err error) {
t.Fatalf(err.Error())
t.Fatal(err)
},
)
}
Expand All @@ -1382,7 +1382,7 @@ func TestClient_ReloadTLS_DowngradeTLSToPlaintext(t *testing.T) {
}
return true, nil
}, func(err error) {
t.Fatalf(err.Error())
t.Fatal(err)
},
)
}
Expand Down
4 changes: 2 additions & 2 deletions client/consul/consul_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ func newMockConsulServer() *mockConsulServer {
SecretID: secretID,
}
buf, _ := json.Marshal(token)
fmt.Fprintf(w, string(buf))
fmt.Fprint(w, string(buf))
return
}

w.WriteHeader(srv.errorCodeOnTokenSelf)
fmt.Fprintf(w, "{}")
fmt.Fprint(w, "{}")
})

srv.httpSrv = httptest.NewServer(mux)
Expand Down
3 changes: 2 additions & 1 deletion command/agent/alloc_endpoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package agent
import (
"archive/tar"
"context"
"errors"
"fmt"
"io"
"net/http"
Expand Down Expand Up @@ -759,7 +760,7 @@ func TestHTTP_AllocSnapshot_Atomic(t *testing.T) {
return false, err
}

return serverAlloc.ClientStatus == structs.AllocClientStatusRunning, fmt.Errorf(serverAlloc.ClientStatus)
return serverAlloc.ClientStatus == structs.AllocClientStatusRunning, errors.New(serverAlloc.ClientStatus)
}, func(err error) {
t.Fatalf("client not running alloc: %v", err)
})
Expand Down
2 changes: 1 addition & 1 deletion command/agent/retry_join_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func TestRetryJoin_Integration(t *testing.T) {
}
return true, nil
}, func(err error) {
t.Fatalf(err.Error())
t.Fatal(err)
})
}

Expand Down
8 changes: 4 additions & 4 deletions nomad/leader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -369,17 +369,17 @@ func TestLeader_PeriodicDispatcher_Restore_Adds(t *testing.T) {
leader.periodicDispatcher.l.Lock()
defer leader.periodicDispatcher.l.Unlock()
if _, tracked := leader.periodicDispatcher.tracked[tuplePeriodic]; !tracked {
return false, fmt.Errorf("periodic job not tracked")
return false, errors.New("periodic job not tracked")
}
if _, tracked := leader.periodicDispatcher.tracked[tupleNonPeriodic]; tracked {
return false, fmt.Errorf("non periodic job tracked")
return false, errors.New("non periodic job tracked")
}
if _, tracked := leader.periodicDispatcher.tracked[tupleParameterized]; tracked {
return false, fmt.Errorf("parameterized periodic job tracked")
return false, errors.New("parameterized periodic job tracked")
}
return true, nil
}, func(err error) {
t.Fatalf(err.Error())
t.Fatal(err)
})
}

Expand Down

0 comments on commit 29e0d3a

Please sign in to comment.