Skip to content

Commit

Permalink
fixup! test: add unit tests for pkg/client/state
Browse files Browse the repository at this point in the history
  • Loading branch information
dkoshkin committed Jan 9, 2024
1 parent 6bf7f1c commit 5a4d7c6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions pkg/client/status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import (
"github.com/stretchr/testify/assert"
"k8s.io/apimachinery/pkg/util/wait"

nutanixTestClient "github.com/nutanix-cloud-native/cluster-api-provider-nutanix/test/helpers/prism-go-client/v3"
nutanixtestclient "github.com/nutanix-cloud-native/cluster-api-provider-nutanix/test/helpers/prism-go-client/v3"
)

func Test_GetTaskStatus(t *testing.T) {
client, err := nutanixTestClient.NewTestClient()
client, err := nutanixtestclient.NewTestClient()
assert.NoError(t, err)
// use cleanup over defer as the connection gets closed before the tests run with t.Parallel()
t.Cleanup(func() {
Expand Down Expand Up @@ -73,7 +73,7 @@ func Test_GetTaskStatus(t *testing.T) {
tt := tt // Capture range variable.
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
client.AddHandler(nutanixTestClient.GetTaskURLPath(tt.taskUUID), tt.handler)
client.AddHandler(nutanixtestclient.GetTaskURLPath(tt.taskUUID), tt.handler)

status, err := GetTaskStatus(tt.ctx, client.Client, tt.taskUUID)
assert.Equal(t, tt.expectedErr, err)
Expand All @@ -83,7 +83,7 @@ func Test_GetTaskStatus(t *testing.T) {
}

func Test_WaitForTaskCompletion(t *testing.T) {
client, err := nutanixTestClient.NewTestClient()
client, err := nutanixtestclient.NewTestClient()
assert.NoError(t, err)
// use cleanup over defer as the connection gets closed before the tests run with t.Parallel()
t.Cleanup(func() {
Expand Down Expand Up @@ -134,7 +134,7 @@ func Test_WaitForTaskCompletion(t *testing.T) {
tt := tt // Capture range variable.
t.Run(tt.name, func(t *testing.T) {
t.Parallel()
client.AddHandler(nutanixTestClient.GetTaskURLPath(tt.taskUUID), tt.handler)
client.AddHandler(nutanixtestclient.GetTaskURLPath(tt.taskUUID), tt.handler)

err := WaitForTaskToSucceed(tt.ctx, client.Client, tt.taskUUID)
if tt.expectedErr != nil {
Expand Down

0 comments on commit 5a4d7c6

Please sign in to comment.