diff --git a/controller/linodeobjectstoragebucket_controller.go b/controller/linodeobjectstoragebucket_controller.go index 3885340e9..046baa842 100644 --- a/controller/linodeobjectstoragebucket_controller.go +++ b/controller/linodeobjectstoragebucket_controller.go @@ -86,7 +86,7 @@ func (r *LinodeObjectStorageBucketReconciler) Reconcile(ctx context.Context, req return ctrl.Result{}, err } - bs, err := scope.NewObjectStorageBucketScope( + bScope, err := scope.NewObjectStorageBucketScope( ctx, r.LinodeApiKey, scope.ObjectStorageBucketScopeParams{ @@ -101,7 +101,7 @@ func (r *LinodeObjectStorageBucketReconciler) Reconcile(ctx context.Context, req return ctrl.Result{}, fmt.Errorf("failed to create object storage bucket scope: %w", err) } - return r.reconcile(ctx, bs) + return r.reconcile(ctx, bScope) } func (r *LinodeObjectStorageBucketReconciler) reconcile(ctx context.Context, bScope *scope.ObjectStorageBucketScope) (res ctrl.Result, reterr error) { diff --git a/e2e/Makefile b/e2e/Makefile index 994aeff35..001c2a366 100644 --- a/e2e/Makefile +++ b/e2e/Makefile @@ -19,3 +19,6 @@ callLinodeApiGet: callLinodeApiPost: @curl -s -H "Authorization: Bearer $$LINODE_TOKEN" -H "Content-Type: application/json" -d "$$BODY" -X POST "https://$(TARGET_API)/$(TARGET_API_VERSION)/$$URI" + +callLinodeApiDelete: + @curl -s -H "Authorization: Bearer $$LINODE_TOKEN" -X DELETE "https://$(TARGET_API)/$(TARGET_API_VERSION)/$$URI" diff --git a/e2e/linodeobjectstoragebucket-controller/minimal-linodeobjectstoragebucket/00-ensure-no-bucket.yaml b/e2e/linodeobjectstoragebucket-controller/minimal-linodeobjectstoragebucket/00-ensure-no-bucket.yaml new file mode 100644 index 000000000..ae0bf51a7 --- /dev/null +++ b/e2e/linodeobjectstoragebucket-controller/minimal-linodeobjectstoragebucket/00-ensure-no-bucket.yaml @@ -0,0 +1,5 @@ +apiVersion: kuttl.dev/v1beta1 +kind: TestStep +commands: + - script: |- + URI="object-storage/buckets/us-sea-1/linodeobjectstoragebucket-sample" make callLinodeApiDelete || exit 0