From a8d411a77beef774acaa99821276396fcc12166c Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Wed, 17 Mar 2021 22:02:13 +0100 Subject: [PATCH] outposts: fix integration test failing occasionally Signed-off-by: Jens Langhammer --- authentik/outposts/signals.py | 15 ++++++++++++--- .../flows/stages/autosubmit/AutosubmitStage.ts | 3 +-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/authentik/outposts/signals.py b/authentik/outposts/signals.py index 69b8881b9..eb71162bf 100644 --- a/authentik/outposts/signals.py +++ b/authentik/outposts/signals.py @@ -1,4 +1,5 @@ """authentik outpost signals""" +from django.conf import settings from django.db.models import Model from django.db.models.signals import post_save, pre_delete from django.dispatch import receiver @@ -41,6 +42,14 @@ def pre_delete_cleanup(sender, instance: Outpost, **_): """Ensure that Outpost's user is deleted (which will delete the token through cascade)""" instance.user.delete() # To ensure that deployment is cleaned up *consistently* we call the controller, and wait - # for it to finish. We don't want to call it in this thread, as we don't have the K8s - # credentials here - outpost_pre_delete.delay(instance.pk.hex).get() + # for it to finish. We don't want to call it in this thread, as we don't have the Outpost + # Service connection here + try: + outpost_pre_delete.delay(instance.pk.hex).get() + except RuntimeError: + # In e2e/integration tests, this might run inside a thread/process and + # trigger the celery `Never call result.get() within a task` detection + if settings.TEST: + pass + else: + raise diff --git a/web/src/flows/stages/autosubmit/AutosubmitStage.ts b/web/src/flows/stages/autosubmit/AutosubmitStage.ts index f639a59aa..827059fbf 100644 --- a/web/src/flows/stages/autosubmit/AutosubmitStage.ts +++ b/web/src/flows/stages/autosubmit/AutosubmitStage.ts @@ -48,8 +48,7 @@ export class AutosubmitStage extends BaseStage { return html``; })} + ?loading="${true}">