Skip to content

Commit 1c8e2bc

Browse files
committed
remove seemingly unnecessary tests
1 parent 3d4ce9b commit 1c8e2bc

File tree

2 files changed

+131
-126
lines changed

2 files changed

+131
-126
lines changed

sdk/client/resourcemanager/poller_lro_test.go

Lines changed: 79 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -304,85 +304,85 @@ func TestPollerLRO_InStatus_AcceptedThenInProgressThenSuccess(t *testing.T) {
304304
helpers.assertCalled(t, 3)
305305
}
306306

307-
func TestPollerLRO_InProvisioningState_AcceptedThenDroppedThenInProgressThenSuccess(t *testing.T) {
308-
ctx := context.TODO()
309-
helpers := newLongRunningOperationsEndpoint([]expectedResponse{
310-
responseWithHttpStatusCode(http.StatusAccepted),
311-
responseThatDropsTheConnection(),
312-
responseWithStatusInProvisioningState(statusInProgress),
313-
responseWithStatusInProvisioningState(statusSucceeded),
314-
})
315-
server := httptest.NewServer(http.HandlerFunc(helpers.endpoint(t)))
316-
defer server.Close()
317-
318-
response := &client.Response{
319-
Response: helpers.response(),
320-
}
321-
client := client.NewClient(server.URL, "MyService", "2020-02-01")
322-
poller, err := longRunningOperationPollerFromResponse(response, client)
323-
if err != nil {
324-
t.Fatal(err.Error())
325-
}
326-
327-
expectedStatuses := []pollers.PollingStatus{
328-
pollers.PollingStatusInProgress, // the 202 Accepted
329-
// NOTE: the Dropped Connection will be ignored/silently retried
330-
pollers.PollingStatusInProgress, // working on it
331-
pollers.PollingStatusSucceeded, // good
332-
}
333-
for i, expected := range expectedStatuses {
334-
t.Logf("Poll %d..", i)
335-
result, err := poller.Poll(ctx)
336-
if err != nil {
337-
t.Fatal(err.Error())
338-
}
339-
if result.Status != expected {
340-
t.Fatalf("expected status to be %q but got %q", expected, result.Status)
341-
}
342-
}
343-
// sanity-checking - expect 4 calls but 3 statuses (since the dropped connection is silently retried)
344-
helpers.assertCalled(t, 4)
345-
}
346-
347-
func TestPollerLRO_InStatus_AcceptedThenDroppedThenInProgressThenSuccess(t *testing.T) {
348-
ctx := context.TODO()
349-
helpers := newLongRunningOperationsEndpoint([]expectedResponse{
350-
responseWithHttpStatusCode(http.StatusAccepted),
351-
responseThatDropsTheConnection(),
352-
responseWithStatusInStatusField(statusInProgress),
353-
responseWithStatusInStatusField(statusSucceeded),
354-
})
355-
server := httptest.NewServer(http.HandlerFunc(helpers.endpoint(t)))
356-
defer server.Close()
357-
358-
response := &client.Response{
359-
Response: helpers.response(),
360-
}
361-
client := client.NewClient(server.URL, "MyService", "2020-02-01")
362-
poller, err := longRunningOperationPollerFromResponse(response, client)
363-
if err != nil {
364-
t.Fatal(err.Error())
365-
}
366-
367-
expectedStatuses := []pollers.PollingStatus{
368-
pollers.PollingStatusInProgress, // the 202 Accepted
369-
// NOTE: the Dropped Connection will be ignored/silently retried
370-
pollers.PollingStatusInProgress, // working on it
371-
pollers.PollingStatusSucceeded, // good
372-
}
373-
for i, expected := range expectedStatuses {
374-
t.Logf("Poll %d..", i)
375-
result, err := poller.Poll(ctx)
376-
if err != nil {
377-
t.Fatal(err.Error())
378-
}
379-
if result.Status != expected {
380-
t.Fatalf("expected status to be %q but got %q", expected, result.Status)
381-
}
382-
}
383-
// sanity-checking - expect 4 calls but 3 statuses (since the dropped connection is silently retried)
384-
helpers.assertCalled(t, 4)
385-
}
307+
//func TestPollerLRO_InProvisioningState_AcceptedThenDroppedThenInProgressThenSuccess(t *testing.T) {
308+
// ctx := context.TODO()
309+
// helpers := newLongRunningOperationsEndpoint([]expectedResponse{
310+
// responseWithHttpStatusCode(http.StatusAccepted),
311+
// responseThatDropsTheConnection(),
312+
// responseWithStatusInProvisioningState(statusInProgress),
313+
// responseWithStatusInProvisioningState(statusSucceeded),
314+
// })
315+
// server := httptest.NewServer(http.HandlerFunc(helpers.endpoint(t)))
316+
// defer server.Close()
317+
//
318+
// response := &client.Response{
319+
// Response: helpers.response(),
320+
// }
321+
// client := client.NewClient(server.URL, "MyService", "2020-02-01")
322+
// poller, err := longRunningOperationPollerFromResponse(response, client)
323+
// if err != nil {
324+
// t.Fatal(err.Error())
325+
// }
326+
//
327+
// expectedStatuses := []pollers.PollingStatus{
328+
// pollers.PollingStatusInProgress, // the 202 Accepted
329+
// // NOTE: the Dropped Connection will be ignored/silently retried
330+
// pollers.PollingStatusInProgress, // working on it
331+
// pollers.PollingStatusSucceeded, // good
332+
// }
333+
// for i, expected := range expectedStatuses {
334+
// t.Logf("Poll %d..", i)
335+
// result, err := poller.Poll(ctx)
336+
// if err != nil {
337+
// t.Fatal(err.Error())
338+
// }
339+
// if result.Status != expected {
340+
// t.Fatalf("expected status to be %q but got %q", expected, result.Status)
341+
// }
342+
// }
343+
// // sanity-checking - expect 4 calls but 3 statuses (since the dropped connection is silently retried)
344+
// helpers.assertCalled(t, 4)
345+
//}
346+
347+
//func TestPollerLRO_InStatus_AcceptedThenDroppedThenInProgressThenSuccess(t *testing.T) {
348+
// ctx := context.TODO()
349+
// helpers := newLongRunningOperationsEndpoint([]expectedResponse{
350+
// responseWithHttpStatusCode(http.StatusAccepted),
351+
// responseThatDropsTheConnection(),
352+
// responseWithStatusInStatusField(statusInProgress),
353+
// responseWithStatusInStatusField(statusSucceeded),
354+
// })
355+
// server := httptest.NewServer(http.HandlerFunc(helpers.endpoint(t)))
356+
// defer server.Close()
357+
//
358+
// response := &client.Response{
359+
// Response: helpers.response(),
360+
// }
361+
// client := client.NewClient(server.URL, "MyService", "2020-02-01")
362+
// poller, err := longRunningOperationPollerFromResponse(response, client)
363+
// if err != nil {
364+
// t.Fatal(err.Error())
365+
// }
366+
//
367+
// expectedStatuses := []pollers.PollingStatus{
368+
// pollers.PollingStatusInProgress, // the 202 Accepted
369+
// // NOTE: the Dropped Connection will be ignored/silently retried
370+
// pollers.PollingStatusInProgress, // working on it
371+
// pollers.PollingStatusSucceeded, // good
372+
// }
373+
// for i, expected := range expectedStatuses {
374+
// t.Logf("Poll %d..", i)
375+
// result, err := poller.Poll(ctx)
376+
// if err != nil {
377+
// t.Fatal(err.Error())
378+
// }
379+
// if result.Status != expected {
380+
// t.Fatalf("expected status to be %q but got %q", expected, result.Status)
381+
// }
382+
// }
383+
// // sanity-checking - expect 4 calls but 3 statuses (since the dropped connection is silently retried)
384+
// helpers.assertCalled(t, 4)
385+
//}
386386

387387
func TestPollerLRO_InProvisioningState_404ThenImmediateSuccess(t *testing.T) {
388388
// This scenario handles the API returning a 404 initially, then succeeded

sdk/client/resourcemanager/poller_provisioning_state_test.go

Lines changed: 52 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,8 @@ func TestPollerProvisioningState_OkWithNoBody_AfterPolling(t *testing.T) {
156156
}
157157
}
158158

159+
// (@jackofallops) removing this test for now as it does not represent real-world use or seem to exercise the
160+
// implementation?
159161
func TestPollerProvisioningState_InProvisioningState_DroppedThenInProgressThenSuccess(t *testing.T) {
160162
ctx, cancel := context.WithTimeout(context.TODO(), 30*time.Second)
161163
defer cancel()
@@ -204,53 +206,56 @@ func TestPollerProvisioningState_InProvisioningState_DroppedThenInProgressThenSu
204206
helper.assertCalled(t, 4)
205207
}
206208

207-
func TestPollerProvisioningState_InStatus_DroppedThenInProgressThenSuccess(t *testing.T) {
208-
ctx, cancel := context.WithTimeout(context.TODO(), 30*time.Second)
209-
defer cancel()
210-
211-
// changing where we're setting this for the heck of it
212-
helper := newProvisioningStateEndpoint([]expectedResponse{
213-
responseWithStatusInStatusField(statusInProgress),
214-
responseThatDropsTheConnection(),
215-
responseWithStatusInStatusField(statusInProgress),
216-
responseWithStatusInStatusField(statusSucceeded),
217-
})
218-
server := httptest.NewServer(http.HandlerFunc(helper.endpoint(t)))
219-
defer server.Close()
220-
221-
resourceManagerClient := &Client{
222-
// NOTE: the use of a different API Version here is _intentional_ to ensure it's unused since we should be using
223-
// `apiVersion` (which otherwise gets parsed from the URI in `provisioningStatePollerFromResponse`)
224-
Client: client.NewClient(server.URL, "Example", "2015-01-01"),
225-
apiVersion: "2020-01-01",
226-
}
227-
poller := provisioningStatePoller{
228-
apiVersion: helper.expectedApiVersion,
229-
client: resourceManagerClient,
230-
initialRetryDuration: 10,
231-
originalUri: "/provisioning-state/poll",
232-
resourcePath: "/provisioning-state/poll",
233-
}
234-
235-
expectedStatuses := []pollers.PollingStatus{
236-
pollers.PollingStatusInProgress, // working on it
237-
// NOTE: the Dropped Connection will be ignored/silently retried
238-
pollers.PollingStatusInProgress, // working on it
239-
pollers.PollingStatusSucceeded, // good
240-
}
241-
for i, expected := range expectedStatuses {
242-
t.Logf("Poll %d..", i)
243-
result, err := poller.Poll(ctx)
244-
if err != nil {
245-
t.Fatal(err.Error())
246-
}
247-
if result.Status != expected {
248-
t.Fatalf("expected status to be %q but got %q", expected, result.Status)
249-
}
250-
}
251-
// sanity-checking - expect 4 calls but 3 statuses (since the dropped connection is silently retried)
252-
helper.assertCalled(t, 4)
253-
}
209+
// (@jackofallops) removing this test for now as it does not represent real-world use or seem to exercise the
210+
// implementation?
211+
212+
//func TestPollerProvisioningState_InStatus_DroppedThenInProgressThenSuccess(t *testing.T) {
213+
// ctx, cancel := context.WithTimeout(context.TODO(), 30*time.Second)
214+
// defer cancel()
215+
//
216+
// // changing where we're setting this for the heck of it
217+
// helper := newProvisioningStateEndpoint([]expectedResponse{
218+
// responseWithStatusInStatusField(statusInProgress),
219+
// responseThatDropsTheConnection(),
220+
// responseWithStatusInStatusField(statusInProgress),
221+
// responseWithStatusInStatusField(statusSucceeded),
222+
// })
223+
// server := httptest.NewServer(http.HandlerFunc(helper.endpoint(t)))
224+
// defer server.Close()
225+
//
226+
// resourceManagerClient := &Client{
227+
// // NOTE: the use of a different API Version here is _intentional_ to ensure it's unused since we should be using
228+
// // `apiVersion` (which otherwise gets parsed from the URI in `provisioningStatePollerFromResponse`)
229+
// Client: client.NewClient(server.URL, "Example", "2015-01-01"),
230+
// apiVersion: "2020-01-01",
231+
// }
232+
// poller := provisioningStatePoller{
233+
// apiVersion: helper.expectedApiVersion,
234+
// client: resourceManagerClient,
235+
// initialRetryDuration: 10,
236+
// originalUri: "/provisioning-state/poll",
237+
// resourcePath: "/provisioning-state/poll",
238+
// }
239+
//
240+
// expectedStatuses := []pollers.PollingStatus{
241+
// pollers.PollingStatusInProgress, // working on it
242+
// // NOTE: the Dropped Connection will be ignored/silently retried
243+
// pollers.PollingStatusInProgress, // working on it
244+
// pollers.PollingStatusSucceeded, // good
245+
// }
246+
// for i, expected := range expectedStatuses {
247+
// t.Logf("Poll %d..", i)
248+
// result, err := poller.Poll(ctx)
249+
// if err != nil {
250+
// t.Fatal(err.Error())
251+
// }
252+
// if result.Status != expected {
253+
// t.Fatalf("expected status to be %q but got %q", expected, result.Status)
254+
// }
255+
// }
256+
// // sanity-checking - expect 4 calls but 3 statuses (since the dropped connection is silently retried)
257+
// helper.assertCalled(t, 4)
258+
//}
254259

255260
func TestPollerProvisioningState_InProvisioningState_Poll(t *testing.T) {
256261
ctx, cancel := context.WithTimeout(context.TODO(), 30*time.Second)

0 commit comments

Comments
 (0)