Skip to content

Commit

Permalink
chore: refactor client tests (#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] committed Jan 29, 2025
1 parent 018ea8e commit 99ad192
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func TestRetryAfter(t *testing.T) {
},
}),
)
res, err := client.Compute.VMs.New(context.Background(), compute.VMNewParams{
_, err := client.Compute.VMs.New(context.Background(), compute.VMNewParams{
BootVolume: nirvana.F(compute.VMNewParamsBootVolume{
Size: nirvana.F(int64(100)),
}),
Expand All @@ -101,8 +101,8 @@ func TestRetryAfter(t *testing.T) {
PublicKey: nirvana.F("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC1234567890"),
}),
})
if err == nil || res != nil {
t.Error("Expected there to be a cancel error and for the response to be nil")
if err == nil {
t.Error("Expected there to be a cancel error")
}

attempts := len(retryCountHeaders)
Expand Down Expand Up @@ -134,7 +134,7 @@ func TestDeleteRetryCountHeader(t *testing.T) {
}),
option.WithHeaderDel("X-Stainless-Retry-Count"),
)
res, err := client.Compute.VMs.New(context.Background(), compute.VMNewParams{
_, err := client.Compute.VMs.New(context.Background(), compute.VMNewParams{
BootVolume: nirvana.F(compute.VMNewParamsBootVolume{
Size: nirvana.F(int64(100)),
}),
Expand All @@ -154,8 +154,8 @@ func TestDeleteRetryCountHeader(t *testing.T) {
PublicKey: nirvana.F("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC1234567890"),
}),
})
if err == nil || res != nil {
t.Error("Expected there to be a cancel error and for the response to be nil")
if err == nil {
t.Error("Expected there to be a cancel error")
}

expectedRetryCountHeaders := []string{"", "", ""}
Expand All @@ -182,7 +182,7 @@ func TestOverwriteRetryCountHeader(t *testing.T) {
}),
option.WithHeader("X-Stainless-Retry-Count", "42"),
)
res, err := client.Compute.VMs.New(context.Background(), compute.VMNewParams{
_, err := client.Compute.VMs.New(context.Background(), compute.VMNewParams{
BootVolume: nirvana.F(compute.VMNewParamsBootVolume{
Size: nirvana.F(int64(100)),
}),
Expand All @@ -202,8 +202,8 @@ func TestOverwriteRetryCountHeader(t *testing.T) {
PublicKey: nirvana.F("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC1234567890"),
}),
})
if err == nil || res != nil {
t.Error("Expected there to be a cancel error and for the response to be nil")
if err == nil {
t.Error("Expected there to be a cancel error")
}

expectedRetryCountHeaders := []string{"42", "42", "42"}
Expand All @@ -229,7 +229,7 @@ func TestRetryAfterMs(t *testing.T) {
},
}),
)
res, err := client.Compute.VMs.New(context.Background(), compute.VMNewParams{
_, err := client.Compute.VMs.New(context.Background(), compute.VMNewParams{
BootVolume: nirvana.F(compute.VMNewParamsBootVolume{
Size: nirvana.F(int64(100)),
}),
Expand All @@ -249,8 +249,8 @@ func TestRetryAfterMs(t *testing.T) {
PublicKey: nirvana.F("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC1234567890"),
}),
})
if err == nil || res != nil {
t.Error("Expected there to be a cancel error and for the response to be nil")
if err == nil {
t.Error("Expected there to be a cancel error")
}
if want := 3; attempts != want {
t.Errorf("Expected %d attempts, got %d", want, attempts)
Expand All @@ -270,7 +270,7 @@ func TestContextCancel(t *testing.T) {
)
cancelCtx, cancel := context.WithCancel(context.Background())
cancel()
res, err := client.Compute.VMs.New(cancelCtx, compute.VMNewParams{
_, err := client.Compute.VMs.New(cancelCtx, compute.VMNewParams{
BootVolume: nirvana.F(compute.VMNewParamsBootVolume{
Size: nirvana.F(int64(100)),
}),
Expand All @@ -290,8 +290,8 @@ func TestContextCancel(t *testing.T) {
PublicKey: nirvana.F("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC1234567890"),
}),
})
if err == nil || res != nil {
t.Error("Expected there to be a cancel error and for the response to be nil")
if err == nil {
t.Error("Expected there to be a cancel error")
}
}

Expand All @@ -308,7 +308,7 @@ func TestContextCancelDelay(t *testing.T) {
)
cancelCtx, cancel := context.WithTimeout(context.Background(), 2*time.Millisecond)
defer cancel()
res, err := client.Compute.VMs.New(cancelCtx, compute.VMNewParams{
_, err := client.Compute.VMs.New(cancelCtx, compute.VMNewParams{
BootVolume: nirvana.F(compute.VMNewParamsBootVolume{
Size: nirvana.F(int64(100)),
}),
Expand All @@ -328,8 +328,8 @@ func TestContextCancelDelay(t *testing.T) {
PublicKey: nirvana.F("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC1234567890"),
}),
})
if err == nil || res != nil {
t.Error("expected there to be a cancel error and for the response to be nil")
if err == nil {
t.Error("expected there to be a cancel error")
}
}

Expand All @@ -352,7 +352,7 @@ func TestContextDeadline(t *testing.T) {
},
}),
)
res, err := client.Compute.VMs.New(deadlineCtx, compute.VMNewParams{
_, err := client.Compute.VMs.New(deadlineCtx, compute.VMNewParams{
BootVolume: nirvana.F(compute.VMNewParamsBootVolume{
Size: nirvana.F(int64(100)),
}),
Expand All @@ -372,8 +372,8 @@ func TestContextDeadline(t *testing.T) {
PublicKey: nirvana.F("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC1234567890"),
}),
})
if err == nil || res != nil {
t.Error("expected there to be a deadline error and for the response to be nil")
if err == nil {
t.Error("expected there to be a deadline error")
}
close(testDone)
}()
Expand Down

0 comments on commit 99ad192

Please sign in to comment.