Skip to content

Commit

Permalink
update toolchain, golangci-lint, fix linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
DoctorVin committed Sep 19, 2024
1 parent a8a2584 commit 8299d61
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 24 deletions.
4 changes: 2 additions & 2 deletions client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,10 @@ func TestOpenFiltered(t *testing.T) {
defer cl.Close(context.Background())
want := []string{"tester3", "tester1", "tester2"}
if diff := cmp.Diff(cl.GetMetadata().ProvidersAttempted, want); diff != "" {
t.Errorf(diff)
t.Errorf("diff: %s", diff)
}
want = []string{"tester1", "tester2", "tester3"}
if diff := cmp.Diff(registryNames(cl.Registry.Drivers), want); diff != "" {
t.Errorf(diff)
t.Errorf("diff: %s", diff)
}
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/bmc-toolbox/bmclib/v2

go 1.18
go 1.23

require (
dario.cat/mergo v1.0.0
Expand Down
2 changes: 1 addition & 1 deletion lint.mk
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ LINTERS :=
FIXERS :=

GOLANGCI_LINT_CONFIG := $(LINT_ROOT)/.golangci.yml
GOLANGCI_LINT_VERSION ?= v1.53.3
GOLANGCI_LINT_VERSION ?= v1.61.0
GOLANGCI_LINT_BIN := $(LINT_ROOT)/out/linters/golangci-lint-$(GOLANGCI_LINT_VERSION)-$(LINT_ARCH)
$(GOLANGCI_LINT_BIN):
mkdir -p $(LINT_ROOT)/out/linters
Expand Down
14 changes: 7 additions & 7 deletions providers/asrockrack/asrockrack_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
func TestHttpLogin(t *testing.T) {
err := aClient.httpsLogin(context.TODO())
if err != nil {
t.Errorf(err.Error())
t.Errorf("login: %s", err.Error())
}

assert.Equal(t, "l5L29IP7", aClient.loginSession.CSRFToken)
Expand All @@ -21,30 +21,30 @@ func TestHttpLogin(t *testing.T) {
func TestClose(t *testing.T) {
err := aClient.httpsLogin(context.TODO())
if err != nil {
t.Errorf(err.Error())
t.Errorf("login setup: %s", err.Error())
}

err = aClient.httpsLogout(context.TODO())
if err != nil {
t.Errorf(err.Error())
t.Errorf("logout: %s", err.Error())
}
}

func TestFirwmwareUpdateBMC(t *testing.T) {
err := aClient.httpsLogin(context.TODO())
if err != nil {
t.Errorf(err.Error())
t.Errorf("login: %s", err.Error())
}

upgradeFile := "/tmp/dummy-E3C246D4I-NL_L0.01.00.ima"
_, err = os.Create(upgradeFile)
if err != nil {
t.Errorf(err.Error())
t.Errorf("create file: %s", err.Error())
}

fh, err := os.Open(upgradeFile)
if err != nil {
t.Errorf(err.Error())
t.Errorf("file open: %s", err.Error())
}

defer fh.Close()
Expand All @@ -53,6 +53,6 @@ func TestFirwmwareUpdateBMC(t *testing.T) {

err = aClient.firmwareUploadBMC(ctx, fh)
if err != nil {
t.Errorf(err.Error())
t.Errorf("upload: %s", err.Error())
}
}
6 changes: 3 additions & 3 deletions providers/asrockrack/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ func (a *ASRockRack) httpsLogin(ctx context.Context) error {

resp, statusCode, err := a.queryHTTPS(ctx, urlEndpoint, "POST", bytes.NewReader(payload), headers, 0)
if err != nil {
return fmt.Errorf("Error logging in: " + err.Error())
return errors.Wrap(err, "logging in")
}

if statusCode == 401 {
Expand All @@ -568,7 +568,7 @@ func (a *ASRockRack) httpsLogin(ctx context.Context) error {
// Unmarshal login session
err = json.Unmarshal(resp, a.loginSession)
if err != nil {
return fmt.Errorf("error unmarshalling response payload: " + err.Error())
return errors.Wrap(err, "unmarshalling response payload")
}

return nil
Expand All @@ -578,7 +578,7 @@ func (a *ASRockRack) httpsLogin(ctx context.Context) error {
func (a *ASRockRack) httpsLogout(ctx context.Context) error {
_, statusCode, err := a.queryHTTPS(ctx, "api/session", "DELETE", nil, nil, 0)
if err != nil {
return fmt.Errorf("Error logging out: " + err.Error())
return errors.Wrap(err, "logging out")
}

if statusCode != http.StatusOK {
Expand Down
14 changes: 7 additions & 7 deletions providers/asrockrack/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ func Test_FirmwareInfo(t *testing.T) {

err := aClient.httpsLogin(context.TODO())
if err != nil {
t.Errorf(err.Error())
t.Errorf("login: %s", err.Error())
}

fwInfo, err := aClient.firmwareInfo(context.TODO())
if err != nil {
t.Error(err.Error())
t.Errorf("firmwareInfo: %s", err.Error())
}

assert.Equal(t, expected, fwInfo)
Expand All @@ -35,7 +35,7 @@ func Test_FirmwareInfo(t *testing.T) {
func TestInventoryInfo(t *testing.T) {
err := aClient.httpsLogin(context.TODO())
if err != nil {
t.Errorf(err.Error())
t.Errorf("login: %s", err.Error())
}

inventory, err := aClient.inventoryInfoE3C246D41D(context.TODO())
Expand All @@ -50,7 +50,7 @@ func TestInventoryInfo(t *testing.T) {
func Test_fruInfo(t *testing.T) {
err := aClient.httpsLogin(context.TODO())
if err != nil {
t.Errorf(err.Error())
t.Errorf("login: %s", err.Error())
}

frus, err := aClient.fruInfo(context.TODO())
Expand All @@ -64,7 +64,7 @@ func Test_fruInfo(t *testing.T) {
func Test_sensors(t *testing.T) {
err := aClient.httpsLogin(context.TODO())
if err != nil {
t.Errorf(err.Error())
t.Errorf("login: %s", err.Error())
}

sensors, err := aClient.sensors(context.TODO())
Expand All @@ -83,7 +83,7 @@ func Test_biosPOSTCode(t *testing.T) {

err := aClient.httpsLogin(context.TODO())
if err != nil {
t.Errorf(err.Error())
t.Errorf("login: %s", err.Error())
}

info, err := aClient.postCodeInfo(context.TODO())
Expand All @@ -102,7 +102,7 @@ func Test_chassisStatus(t *testing.T) {

err := aClient.httpsLogin(context.TODO())
if err != nil {
t.Errorf(err.Error())
t.Errorf("login: %s", err.Error())
}

info, err := aClient.chassisStatusInfo(context.TODO())
Expand Down
6 changes: 3 additions & 3 deletions providers/asrockrack/user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func Test_UserRead(t *testing.T) {

err := aClient.httpsLogin(context.TODO())
if err != nil {
t.Errorf(err.Error())
t.Errorf("login: %s", err.Error())
}

users, err := aClient.UserRead(context.TODO())
Expand Down Expand Up @@ -159,7 +159,7 @@ func Test_UserUpdate(t *testing.T) {
func Test_createUser(t *testing.T) {
err := aClient.httpsLogin(context.TODO())
if err != nil {
t.Errorf(err.Error())
t.Errorf("login: %s", err.Error())
}

account := &UserAccount{
Expand Down Expand Up @@ -202,7 +202,7 @@ func Test_createUser(t *testing.T) {
func Test_userAccounts(t *testing.T) {
err := aClient.httpsLogin(context.TODO())
if err != nil {
t.Errorf(err.Error())
t.Errorf("login: %s", err.Error())
}

account0 := &UserAccount{
Expand Down

0 comments on commit 8299d61

Please sign in to comment.