Merge pull request #328 from docker/do_not_wait_cleanup_results

In ACI e2e tests, do not wait for full resource group deletion at the end
This commit is contained in:
Guillaume Tardif 2020-07-02 16:43:19 +02:00 committed by GitHub
commit 5a7f780bae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 10 deletions

View File

@ -221,7 +221,7 @@ func (s *MockResourceGroupHelper) CreateOrUpdate(ctx context.Context, subscripti
return args.Get(0).(resources.Group), args.Error(1) return args.Get(0).(resources.Group), args.Error(1)
} }
func (s *MockResourceGroupHelper) Delete(ctx context.Context, subscriptionID string, resourceGroupName string) (err error) { func (s *MockResourceGroupHelper) DeleteAsync(ctx context.Context, subscriptionID string, resourceGroupName string) (err error) {
args := s.Called(ctx, subscriptionID, resourceGroupName) args := s.Called(ctx, subscriptionID, resourceGroupName)
return args.Error(0) return args.Error(0)
} }

View File

@ -32,7 +32,7 @@ type ACIResourceGroupHelper interface {
ListGroups(ctx context.Context, subscriptionID string) ([]resources.Group, error) ListGroups(ctx context.Context, subscriptionID string) ([]resources.Group, error)
GetGroup(ctx context.Context, subscriptionID string, groupName string) (resources.Group, error) GetGroup(ctx context.Context, subscriptionID string, groupName string) (resources.Group, error)
CreateOrUpdate(ctx context.Context, subscriptionID string, resourceGroupName string, parameters resources.Group) (result resources.Group, err error) CreateOrUpdate(ctx context.Context, subscriptionID string, resourceGroupName string, parameters resources.Group) (result resources.Group, err error)
Delete(ctx context.Context, subscriptionID string, resourceGroupName string) error DeleteAsync(ctx context.Context, subscriptionID string, resourceGroupName string) error
} }
type aciResourceGroupHelperImpl struct { type aciResourceGroupHelperImpl struct {
@ -87,18 +87,15 @@ func (mgt aciResourceGroupHelperImpl) CreateOrUpdate(ctx context.Context, subscr
return gc.CreateOrUpdate(ctx, resourceGroupName, parameters) return gc.CreateOrUpdate(ctx, resourceGroupName, parameters)
} }
// Delete deletes a resource group // DeleteAsync deletes a resource group. Does not wait for full deletion to return (long operation)
func (mgt aciResourceGroupHelperImpl) Delete(ctx context.Context, subscriptionID string, resourceGroupName string) (err error) { func (mgt aciResourceGroupHelperImpl) DeleteAsync(ctx context.Context, subscriptionID string, resourceGroupName string) (err error) {
gc, err := getGroupsClient(subscriptionID) gc, err := getGroupsClient(subscriptionID)
if err != nil { if err != nil {
return err return err
} }
future, err := gc.Delete(ctx, resourceGroupName) _, err = gc.Delete(ctx, resourceGroupName)
if err != nil { return err
return err
}
return future.WaitForCompletionRef(ctx, gc.Client)
} }
// GetSubscriptionIDs Return available subscription IDs based on azure login // GetSubscriptionIDs Return available subscription IDs based on azure login

View File

@ -331,7 +331,7 @@ func deleteResourceGroup(groupName string) {
helper := azure.NewACIResourceGroupHelper() helper := azure.NewACIResourceGroupHelper()
models, err := helper.GetSubscriptionIDs(ctx) models, err := helper.GetSubscriptionIDs(ctx)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
err = helper.Delete(ctx, *models[0].SubscriptionID, groupName) err = helper.DeleteAsync(ctx, *models[0].SubscriptionID, groupName)
Expect(err).To(BeNil()) Expect(err).To(BeNil())
} }