From e02d6bcdc5146495905e8b0d2caddfa508e8fa6a Mon Sep 17 00:00:00 2001 From: Alex Zgabur Date: Wed, 15 Mar 2023 16:17:33 +0100 Subject: [PATCH] Add HTTPRoute delete reconciliation test --- .../reconciliation/test_httproute_delete.py | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 testsuite/tests/kuadrant/reconciliation/test_httproute_delete.py diff --git a/testsuite/tests/kuadrant/reconciliation/test_httproute_delete.py b/testsuite/tests/kuadrant/reconciliation/test_httproute_delete.py new file mode 100644 index 00000000..111ade57 --- /dev/null +++ b/testsuite/tests/kuadrant/reconciliation/test_httproute_delete.py @@ -0,0 +1,27 @@ +"""Tests that AuthPolicy is reconciled after HTTPRoute deletion.""" +import pytest + + +@pytest.mark.issue("https://github.com/Kuadrant/kuadrant-operator/issues/124") +def test_delete(client, authorization, resilient_request): + """ + Tests that after deleting HTTPRoute, status.conditions shows it missing: + * Test that that client works + * Delete associated HTTPRoute + * Test that client now does not work + * AuthPolicy cache refresh + * Test that status.conditions of AuthPolicy detects missing HTTPRoute + """ + + response = client.get("/get") + assert response.status_code == 200 + + authorization.route.delete() + + response = resilient_request("/get", http_client=client, expected_status=404) + assert response.status_code == 404, "Removing HTTPRoute was not reconciled" + + authorization.refresh() + condition = authorization.model.status.conditions[0] + assert condition.status == "False" + assert "not found" in condition.message