From 86017e888abd202cc662970e65ebc2ff1283db50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20Goinvic?= Date: Mon, 26 May 2025 12:13:55 +0200 Subject: [PATCH] add markers in the deployment and test their values --- .../test_matrix_authentication_service.py | 13 +++++++++++++ tests/integration/test_synapse.py | 14 ++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/tests/integration/test_matrix_authentication_service.py b/tests/integration/test_matrix_authentication_service.py index 5b90b80c..f8f8ae8b 100644 --- a/tests/integration/test_matrix_authentication_service.py +++ b/tests/integration/test_matrix_authentication_service.py @@ -3,6 +3,7 @@ # SPDX-License-Identifier: AGPL-3.0-only import pytest +from lightkube.resources.core_v1 import Secret from .fixtures import ESSData from .lib.utils import aiohttp_post_json, value_file_has @@ -22,3 +23,15 @@ async def test_matrix_authentication_service_graphql_endpoint(ingress_ready, gen assert "errors" not in json_content or len(json_content["errors"]) == 0, json_content # When not authenticated, the userByUsername will return an empty result whatever the username queried assert json_content["data"] == {"userByUsername": None} + + +@pytest.mark.skipif(value_file_has("matrixAuthenticationService.enabled", False), reason="MAS not deployed") +@pytest.mark.asyncio_cooperative +async def test_matrix_authentication_service_marker_delegated_auth(kube_client, generated_data: ESSData, ssl_context): + secret = await kube_client.get( + Secret, + namespace=generated_data.ess_namespace, + name="{generated_data.name}-generated-secret", + ) + assert secret.data.get("MATRIX_STACK_MSC3861") is not None + assert secret.data.get("MATRIX_STACK_MSC3861") == b"delegated_auth" diff --git a/tests/integration/test_synapse.py b/tests/integration/test_synapse.py index cf6daac4..28ff6b6c 100644 --- a/tests/integration/test_synapse.py +++ b/tests/integration/test_synapse.py @@ -6,6 +6,7 @@ import hashlib from pathlib import Path import pytest +from lightkube.resources.core_v1 import Secret from .fixtures import ESSData from .lib.synapse import assert_downloaded_content, download_media, upload_media @@ -114,3 +115,16 @@ async def test_rendezvous_cors_headers_are_only_set_with_mas(ingress_ready, gene assert "Synapse-Trace-Id" in response.headers["Access-Control-Expose-Headers"] assert "Server" in response.headers["Access-Control-Expose-Headers"] assert ("ETag" in response.headers["Access-Control-Expose-Headers"]) == supports_qr_code_login + + +@pytest.mark.skipif(value_file_has("synapse.enabled", False), reason="Synapse not deployed") +@pytest.mark.skipif(value_file_has("matrixAuthenticationService.enabled", True), reason="MAS is deployed") +@pytest.mark.asyncio_cooperative +async def test_synapse_service_marker_legacy_auth(kube_client, generated_data: ESSData, ssl_context): + secret = await kube_client.get( + Secret, + namespace=generated_data.ess_namespace, + name="{generated_data.name}-generated-secret", + ) + assert secret.data.get("MATRIX_STACK_MSC3861") is not None + assert secret.data.get("MATRIX_STACK_MSC3861") == b"legacy_auth"