outposts: fix integration test failing occasionally

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-03-17 22:02:13 +01:00
parent 5f6f5dbfc4
commit a8d411a77b
2 changed files with 13 additions and 5 deletions

View File

@ -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

View File

@ -48,8 +48,7 @@ export class AutosubmitStage extends BaseStage {
return html`<input type="hidden" name="${key}" value="${value}">`;
})}
<ak-empty-state
?loading="${true}"
header=${gettext("Loading")}>
?loading="${true}">
</ak-empty-state>
<div class="pf-c-form__group pf-m-action">
<button type="submit" class="pf-c-button pf-m-primary pf-m-block">