mirror of
https://github.com/SigNoz/signoz.git
synced 2026-08-11 07:20:48 +01:00
#### Description - Adds end-to-end coverage for the google authn flow (`callbackauthn/04_google.py`): happy-path login, hd-claim mismatch rejection, unverified-email rejection + `insecureSkipEmailVerified` opt-in, and roleMapping defaultRole. - The google callback authn hardcodes `https://accounts.google.com` as its issuer and fully verifies the RS256 id_token, so a wiremock container impersonates Google: it joins the test network under the `accounts.google.com` alias and serves HTTPS with a certificate issued by a new integration CA (`tests/fixtures/tls.py`), which every signoz container now trusts via `SSL_CERT_FILE`. - Stubs (discovery, auto-approving authorize, token, JWKS) are installed per test via the existing `make_http_mocks` fixture with a pre-signed id_token for the identity under test; one session-scoped RSA key signs all tokens.
47 lines
1.6 KiB
Python
47 lines
1.6 KiB
Python
import logging
|
|
from http import HTTPStatus
|
|
|
|
import numpy as np
|
|
import requests
|
|
|
|
from fixtures import types
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
def test_setup(signoz: types.SigNoz) -> None:
|
|
response = requests.get(signoz.self.host_configs["8080"].get("/api/v1/version"), timeout=2)
|
|
assert response.status_code == HTTPStatus.OK
|
|
|
|
healthz = requests.get(signoz.self.host_configs["8080"].get("/api/v2/healthz"), timeout=2)
|
|
logger.info("healthz response: %s", healthz.json())
|
|
assert healthz.status_code == HTTPStatus.OK
|
|
|
|
|
|
def test_telemetry_databases_exist(signoz: types.SigNoz) -> None:
|
|
arr: np.ndarray = signoz.telemetrystore.conn.query_np("SHOW DATABASES")
|
|
databases = arr.tolist() if arr.size > 0 else []
|
|
required_databases = [
|
|
"signoz_metrics",
|
|
"signoz_logs",
|
|
"signoz_traces",
|
|
"signoz_metadata",
|
|
"signoz_analytics",
|
|
"signoz_meter",
|
|
]
|
|
|
|
for db_name in required_databases:
|
|
assert any(db_name in str(db) for db in databases), f"Database {db_name} not found"
|
|
|
|
|
|
def test_teardown(
|
|
signoz: types.SigNoz, # pylint: disable=unused-argument
|
|
idp: types.TestContainerIDP, # pylint: disable=unused-argument
|
|
googleidp: types.TestContainerDocker, # pylint: disable=unused-argument
|
|
create_user_admin: types.Operation, # pylint: disable=unused-argument
|
|
migrator: types.Operation, # pylint: disable=unused-argument
|
|
maildev: types.TestContainerDocker, # pylint: disable=unused-argument
|
|
notification_channel: types.TestContainerDocker, # pylint: disable=unused-argument
|
|
) -> None:
|
|
pass
|