Skip to content

Commit

Permalink
missed a test
Browse files Browse the repository at this point in the history
  • Loading branch information
jackofallops committed Oct 23, 2024
1 parent 1c8e2bc commit 92ddd11
Showing 1 changed file with 47 additions and 47 deletions.
94 changes: 47 additions & 47 deletions sdk/client/resourcemanager/poller_provisioning_state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,53 +158,53 @@ func TestPollerProvisioningState_OkWithNoBody_AfterPolling(t *testing.T) {

// (@jackofallops) removing this test for now as it does not represent real-world use or seem to exercise the
// implementation?
func TestPollerProvisioningState_InProvisioningState_DroppedThenInProgressThenSuccess(t *testing.T) {
ctx, cancel := context.WithTimeout(context.TODO(), 30*time.Second)
defer cancel()

// changing where we're setting this for the heck of it
helper := newProvisioningStateEndpoint([]expectedResponse{
responseWithStatusInProvisioningState(statusInProgress),
responseThatDropsTheConnection(),
responseWithStatusInProvisioningState(statusInProgress),
responseWithStatusInProvisioningState(statusSucceeded),
})
server := httptest.NewServer(http.HandlerFunc(helper.endpoint(t)))
defer server.Close()

resourceManagerClient := &Client{
// NOTE: the use of a different API Version here is _intentional_ to ensure it's unused since we should be using
// `apiVersion` (which otherwise gets parsed from the URI in `provisioningStatePollerFromResponse`)
Client: client.NewClient(server.URL, "Example", "2015-01-01"),
apiVersion: "2020-01-01",
}
poller := provisioningStatePoller{
apiVersion: helper.expectedApiVersion,
client: resourceManagerClient,
initialRetryDuration: 10,
originalUri: "/provisioning-state/poll",
resourcePath: "/provisioning-state/poll",
}

expectedStatuses := []pollers.PollingStatus{
pollers.PollingStatusInProgress, // working on it
// NOTE: the Dropped Connection will be ignored/silently retried
pollers.PollingStatusInProgress, // working on it
pollers.PollingStatusSucceeded, // good
}
for i, expected := range expectedStatuses {
t.Logf("Poll %d..", i)
result, err := poller.Poll(ctx)
if err != nil {
t.Fatal(err.Error())
}
if result.Status != expected {
t.Fatalf("expected status to be %q but got %q", expected, result.Status)
}
}
// sanity-checking - expect 4 calls but 3 statuses (since the dropped connection is silently retried)
helper.assertCalled(t, 4)
}
// func TestPollerProvisioningState_InProvisioningState_DroppedThenInProgressThenSuccess(t *testing.T) {
// ctx, cancel := context.WithTimeout(context.TODO(), 30*time.Second)
// defer cancel()
//
// // changing where we're setting this for the heck of it
// helper := newProvisioningStateEndpoint([]expectedResponse{
// responseWithStatusInProvisioningState(statusInProgress),
// responseThatDropsTheConnection(),
// responseWithStatusInProvisioningState(statusInProgress),
// responseWithStatusInProvisioningState(statusSucceeded),
// })
// server := httptest.NewServer(http.HandlerFunc(helper.endpoint(t)))
// defer server.Close()
//
// resourceManagerClient := &Client{
// // NOTE: the use of a different API Version here is _intentional_ to ensure it's unused since we should be using
// // `apiVersion` (which otherwise gets parsed from the URI in `provisioningStatePollerFromResponse`)
// Client: client.NewClient(server.URL, "Example", "2015-01-01"),
// apiVersion: "2020-01-01",
// }
// poller := provisioningStatePoller{
// apiVersion: helper.expectedApiVersion,
// client: resourceManagerClient,
// initialRetryDuration: 10,
// originalUri: "/provisioning-state/poll",
// resourcePath: "/provisioning-state/poll",
// }
//
// expectedStatuses := []pollers.PollingStatus{
// pollers.PollingStatusInProgress, // working on it
// // NOTE: the Dropped Connection will be ignored/silently retried
// pollers.PollingStatusInProgress, // working on it
// pollers.PollingStatusSucceeded, // good
// }
// for i, expected := range expectedStatuses {
// t.Logf("Poll %d..", i)
// result, err := poller.Poll(ctx)
// if err != nil {
// t.Fatal(err.Error())
// }
// if result.Status != expected {
// t.Fatalf("expected status to be %q but got %q", expected, result.Status)
// }
// }
// // sanity-checking - expect 4 calls but 3 statuses (since the dropped connection is silently retried)
// helper.assertCalled(t, 4)
// }

// (@jackofallops) removing this test for now as it does not represent real-world use or seem to exercise the
// implementation?
Expand Down

0 comments on commit 92ddd11

Please sign in to comment.