Skip to content

Commit

Permalink
Update tests to validate new error return is nil
Browse files Browse the repository at this point in the history
  • Loading branch information
splaspood committed Oct 28, 2024
1 parent 43237b1 commit 9705c04
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
8 changes: 6 additions & 2 deletions providers/supermicro/firmware_bios_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ func Test_setComponentUpdateMisc(t *testing.T) {
t.Fatal(err)
}

serviceClient := newBmcServiceClient(parsedURL.Hostname(), parsedURL.Port(), "foo", "bar", httpclient.Build())
serviceClient, err := newBmcServiceClient(parsedURL.Hostname(), parsedURL.Port(), "foo", "bar", httpclient.Build())
assert.Nil(t, err)

serviceClient.csrfToken = "foobar"
client := &x11{serviceClient: serviceClient, log: logr.Discard()}

Expand Down Expand Up @@ -169,7 +171,9 @@ func Test_setBIOSFirmwareInstallMode(t *testing.T) {
t.Fatal(err)
}

serviceClient := newBmcServiceClient(parsedURL.Hostname(), parsedURL.Port(), "foo", "bar", httpclient.Build())
serviceClient, err := newBmcServiceClient(parsedURL.Hostname(), parsedURL.Port(), "foo", "bar", httpclient.Build())
assert.Nil(t, err)

serviceClient.csrfToken = "foobar"
client := &x11{serviceClient: serviceClient, log: logr.Discard()}

Expand Down
17 changes: 12 additions & 5 deletions providers/supermicro/x11_firmware_bmc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ func TestX11SetBMCFirmwareInstallMode(t *testing.T) {
t.Fatal(err)
}

serviceClient := newBmcServiceClient(parsedURL.Hostname(), parsedURL.Port(), "foo", "bar", httpclient.Build())
serviceClient, err := newBmcServiceClient(parsedURL.Hostname(), parsedURL.Port(), "foo", "bar", httpclient.Build())
assert.Nil(t, err)

client := &x11{serviceClient: serviceClient, log: logr.Discard()}

if err := client.setBMCFirmwareInstallMode(context.Background()); err != nil {
Expand Down Expand Up @@ -184,7 +186,8 @@ func TestX11UploadBMCFirmware(t *testing.T) {
defer os.Remove(binPath)
}

serviceClient := newBmcServiceClient(parsedURL.Hostname(), parsedURL.Port(), "foo", "bar", httpclient.Build())
serviceClient, err := newBmcServiceClient(parsedURL.Hostname(), parsedURL.Port(), "foo", "bar", httpclient.Build())
assert.Nil(t, err)
serviceClient.csrfToken = "foobar"
client := &x11{serviceClient: serviceClient, log: logr.Discard()}

Expand Down Expand Up @@ -265,7 +268,8 @@ func TestX11VerifyBMCFirmwareVersion(t *testing.T) {
t.Fatal(err)
}

serviceClient := newBmcServiceClient(parsedURL.Hostname(), parsedURL.Port(), "foo", "bar", httpclient.Build())
serviceClient, err := newBmcServiceClient(parsedURL.Hostname(), parsedURL.Port(), "foo", "bar", httpclient.Build())
assert.Nil(t, err)
serviceClient.csrfToken = "foobar"
client := &x11{serviceClient: serviceClient, log: logr.Discard()}

Expand Down Expand Up @@ -346,7 +350,8 @@ func TestX11InitiateBMCFirmwareInstall(t *testing.T) {
t.Fatal(err)
}

serviceClient := newBmcServiceClient(parsedURL.Hostname(), parsedURL.Port(), "foo", "bar", httpclient.Build())
serviceClient, err := newBmcServiceClient(parsedURL.Hostname(), parsedURL.Port(), "foo", "bar", httpclient.Build())
assert.Nil(t, err)
serviceClient.csrfToken = "foobar"
client := &x11{serviceClient: serviceClient, log: logr.Discard()}

Expand Down Expand Up @@ -509,7 +514,9 @@ func TestX11StatusBMCFirmwareInstall(t *testing.T) {
t.Fatal(err)
}

serviceClient := newBmcServiceClient(parsedURL.Hostname(), parsedURL.Port(), "foo", "bar", httpclient.Build())
serviceClient, err := newBmcServiceClient(parsedURL.Hostname(), parsedURL.Port(), "foo", "bar", httpclient.Build())
assert.Nil(t, err)

serviceClient.csrfToken = "foobar"
client := &x11{serviceClient: serviceClient, log: logr.Discard()}

Expand Down

0 comments on commit 9705c04

Please sign in to comment.