Skip to content

Commit

Permalink
Delete app with DeletePropagationForeground
Browse files Browse the repository at this point in the history
Co-authored-by: Georgi Sabev <[email protected]>
  • Loading branch information
2 people authored and kieron-dev committed Jul 12, 2023
1 parent fd94c44 commit 3ffaa2a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 4 additions & 1 deletion api/repositories/app_repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,10 @@ func (f *AppRepo) DeleteApp(ctx context.Context, authInfo authorization.Info, me
return fmt.Errorf("failed to build user client: %w", err)
}

return apierrors.FromK8sError(userClient.Delete(ctx, cfApp), AppResourceType)
return apierrors.FromK8sError(
userClient.Delete(ctx, cfApp, client.PropagationPolicy(metav1.DeletePropagationForeground)),
AppResourceType,
)
}

func (f *AppRepo) GetAppEnv(ctx context.Context, authInfo authorization.Info, appGUID string) (AppEnvRecord, error) {
Expand Down
5 changes: 3 additions & 2 deletions api/repositories/app_repository_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1202,8 +1202,9 @@ var _ = Describe("AppRepository", func() {

It("deletes the CFApp resource", func() {
Expect(deleteAppErr).NotTo(HaveOccurred())
_, err := appRepo.GetApp(testCtx, authInfo, appGUID)
Expect(err).To(matchers.WrapErrorAssignableToTypeOf(apierrors.NotFoundError{}))
app, err := appRepo.GetApp(testCtx, authInfo, appGUID)
Expect(err).NotTo(HaveOccurred())
Expect(app.DeletedAt).To(PointTo(BeTemporally("~", time.Now(), 5*time.Second)))
})

When("the app doesn't exist", func() {
Expand Down

0 comments on commit 3ffaa2a

Please sign in to comment.