<?xml version="1.0" encoding="utf-8"?><testsuites name="pytest tests"><testsuite name="pytest" errors="0" failures="5" skipped="0" tests="74" time="568.060" timestamp="2026-06-09T08:15:39.628662+00:00" hostname="maas-group-test-tq7gg-e2e-maas-openshift-pod"><testcase classname="test.e2e.tests.test_api_keys.TestAPIKeyCRUD" name="test_create_api_key" time="0.103" /><testcase classname="test.e2e.tests.test_api_keys.TestAPIKeyCRUD" name="test_list_api_keys" time="0.142" /><testcase classname="test.e2e.tests.test_api_keys.TestAPIKeyCRUD" name="test_revoke_api_key" time="0.096" /><testcase classname="test.e2e.tests.test_api_keys.TestAPIKeyAuthorization" name="test_admin_manage_other_users_keys" time="0.127" /><testcase classname="test.e2e.tests.test_api_keys.TestAPIKeyAuthorization" name="test_non_admin_cannot_access_other_users_keys" time="0.092" /><testcase classname="test.e2e.tests.test_api_keys.TestAPIKeyBulkOperations" name="test_bulk_revoke_own_keys" time="0.248" /><testcase classname="test.e2e.tests.test_api_keys.TestAPIKeyBulkOperations" name="test_bulk_revoke_other_user_forbidden" time="0.032" /><testcase classname="test.e2e.tests.test_api_keys.TestAPIKeyBulkOperations" name="test_bulk_revoke_admin_can_revoke_any_user" time="0.101" /><testcase classname="test.e2e.tests.test_api_keys.TestAPIKeyExpiration" name="test_create_key_within_expiration_limit" time="0.035" /><testcase classname="test.e2e.tests.test_api_keys.TestAPIKeyExpiration" name="test_create_key_at_expiration_limit" time="0.036" /><testcase classname="test.e2e.tests.test_api_keys.TestAPIKeyExpiration" name="test_create_key_exceeds_expiration_limit" time="0.041" /><testcase classname="test.e2e.tests.test_api_keys.TestAPIKeyExpiration" name="test_create_key_without_expiration" time="0.034" /><testcase classname="test.e2e.tests.test_api_keys.TestAPIKeyExpiration" name="test_create_key_with_short_expiration" time="0.032" /><testcase classname="test.e2e.tests.test_api_keys.TestAPIKeyModelInference" name="test_api_key_model_access_success" time="0.106" /><testcase classname="test.e2e.tests.test_api_keys.TestAPIKeyModelInference" name="test_invalid_api_key_rejected" time="0.021" /><testcase classname="test.e2e.tests.test_api_keys.TestAPIKeyModelInference" name="test_no_auth_header_rejected" time="0.018" /><testcase classname="test.e2e.tests.test_api_keys.TestAPIKeyModelInference" name="test_revoked_api_key_rejected" time="2.132" /><testcase classname="test.e2e.tests.test_api_keys.TestAPIKeyModelInference" name="test_api_key_chat_completions" time="0.028" /><testcase classname="test.e2e.tests.test_api_keys.TestAPIKeyRevocationE2E" name="test_double_revoke_returns_404" time="0.097" /><testcase classname="test.e2e.tests.test_api_keys.TestAPIKeyRevocationE2E" name="test_revoke_nonexistent_key_returns_404" time="0.033" /><testcase classname="test.e2e.tests.test_api_keys.TestAPIKeyRevocationE2E" name="test_revoke_then_create_new_key_works" time="0.150" /><testcase classname="test.e2e.tests.test_api_keys.TestAPIKeyRevocationE2E" name="test_individual_revoke_multiple_keys" time="0.195" /><testcase classname="test.e2e.tests.test_api_keys.TestAPIKeyRevocationE2E" name="test_revoke_keys_rejected_at_gateway" time="0.290" /><testcase classname="test.e2e.tests.test_api_keys.TestEphemeralKeyCleanup" name="test_cronjob_exists_and_configured" time="0.108" /><testcase classname="test.e2e.tests.test_api_keys.TestEphemeralKeyCleanup" name="test_cleanup_networkpolicy_exists" time="0.107" /><testcase classname="test.e2e.tests.test_api_keys.TestEphemeralKeyCleanup" name="test_create_ephemeral_key" time="0.101" /><testcase classname="test.e2e.tests.test_api_keys.TestEphemeralKeyCleanup" name="test_trigger_cleanup_preserves_active_keys" time="0.425" /><testcase classname="test.e2e.tests.test_api_keys.TestAPIKeySubscriptionPhases" name="test_create_key_for_active_subscription" time="9.241" /><testcase classname="test.e2e.tests.test_api_keys.TestAPIKeySubscriptionPhases" name="test_create_key_for_degraded_subscription" time="19.150" /><testcase classname="test.e2e.tests.test_api_keys.TestAPIKeySubscriptionPhases" name="test_create_key_for_failed_subscription" time="19.287" /><testcase classname="test.e2e.tests.test_api_keys.TestAPIKeySubscriptionPhases" name="test_create_key_for_pending_subscription" time="19.313" /><testcase classname="test.e2e.tests.test_api_keys.TestAPIKeySubscriptionPhases" name="test_reject_key_for_unreconciled_subscription" time="22.865" /><testcase classname="test.e2e.tests.test_api_keys.TestAPIKeySubscriptionFilter" name="test_search_filters_by_subscription" time="12.120"><failure message="AssertionError: Failed to create key for e2e-filter-sub-a-21b3759a: &#10;assert 500 in (200, 201)&#10; +  where 500 = &lt;Response [500]&gt;.status_code">self = &lt;test_api_keys.TestAPIKeySubscriptionFilter object at 0x7f009d5fc670&gt;
api_keys_base_url = 'https://maas.apps.08258af1-1d51-4b71-b0a5-3050798004eb.prod.konfluxeaas.com/maas-api/v1/api-keys'
headers = {'Authorization': 'Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IkFxdGlBMlJMeWRsUkFYUlR2cmRQODZKd2NlbjRuSzNKcTlSclg0UkZJcDQifQ.e...PMxlBz8e6ENYZbLgpVj9zbcnPUatiJ6wdhxG013vhyWiPfyg9iy_ELqAuyRAoYOjc1zmedZm8924QEGNg', 'Content-Type': 'application/json'}

    def test_search_filters_by_subscription(self, api_keys_base_url: str, headers: dict):
        """Search with subscription filter returns only keys bound to that subscription."""
        sub_a = f"e2e-filter-sub-a-{os.urandom(4).hex()}"
        sub_b = f"e2e-filter-sub-b-{os.urandom(4).hex()}"
        ns = _ns()
        sa_name = f"e2e-filter-sa-{os.urandom(4).hex()}"
    
        key_ids_a = []
        key_ids_b = []
        try:
            # Create one SA authorized for both subscriptions so that
            # exclusion in search results is attributable to the subscription
            # filter, not user-scoping.
            oc_token = _create_sa_token(sa_name, namespace=MODEL_NAMESPACE)
            sa_user = _sa_to_user(sa_name, namespace=MODEL_NAMESPACE)
            sa_headers = {"Authorization": f"Bearer {oc_token}", "Content-Type": "application/json"}
    
            _create_test_auth_policy(f"{sub_a}-auth", MODEL_REF, users=[sa_user])
            _create_test_subscription(sub_a, MODEL_REF, users=[sa_user])
            _wait_for_maas_subscription_phase(sub_a, namespace=ns)
    
            _create_test_auth_policy(f"{sub_b}-auth", MODEL_REF, users=[sa_user])
            _create_test_subscription(sub_b, MODEL_REF, users=[sa_user])
            _wait_for_maas_subscription_phase(sub_b, namespace=ns)
    
            # Create 2 keys bound to sub_a
            for i in range(2):
                r = requests.post(
                    api_keys_base_url,
                    headers=sa_headers,
                    json={"name": f"e2e-filter-a-{i}", "subscription": sub_a},
                    timeout=TIMEOUT,
                    verify=TLS_VERIFY,
                )
&gt;               assert r.status_code in (200, 201), f"Failed to create key for {sub_a}: {r.text}"
E               AssertionError: Failed to create key for e2e-filter-sub-a-21b3759a: 
E               assert 500 in (200, 201)
E                +  where 500 = &lt;Response [500]&gt;.status_code

test/e2e/tests/test_api_keys.py:1510: AssertionError</failure></testcase><testcase classname="test.e2e.tests.test_api_keys.TestAPIKeySubscriptionFilter" name="test_search_without_subscription_returns_all" time="0.191" /><testcase classname="test.e2e.tests.test_namespace_scoping.TestMaaSAPIWatchNamespace" name="test_subscription_in_subscription_namespace_visible_to_api" time="8.534" /><testcase classname="test.e2e.tests.test_namespace_scoping.TestMaaSAPIWatchNamespace" name="test_subscription_in_another_namespace_not_visible_to_api" time="22.910" /><testcase classname="test.e2e.tests.test_namespace_scoping.TestMaaSControllerWatchNamespace" name="test_authpolicy_and_subscription_in_maas_subscription_namespace" time="23.977" /><testcase classname="test.e2e.tests.test_namespace_scoping.TestMaaSControllerWatchNamespace" name="test_authpolicy_and_subscription_in_another_namespace" time="30.202" /><testcase classname="test.e2e.tests.test_namespace_scoping.TestModelRef" name="test_auth_policy_model_ref" time="31.167" /><testcase classname="test.e2e.tests.test_namespace_scoping.TestModelRef" name="test_subscription_model_ref" time="31.312" /><testcase classname="test.e2e.tests.test_negative_security.TestHeaderSpoofing" name="test_injected_identity_headers_ignored" time="0.077" /><testcase classname="test.e2e.tests.test_negative_security.TestHeaderSpoofing" name="test_duplicate_subscription_headers_ignored" time="0.067" /><testcase classname="test.e2e.tests.test_negative_security.TestExpiredKeyRejection" name="test_expired_key_rejected_at_gateway" time="5.064" /><testcase classname="test.e2e.tests.test_negative_security.TestCrossModelAccess" name="test_key_cannot_access_model_outside_subscription" time="0.055" /><testcase classname="test.e2e.tests.test_negative_security.TestAuthPolicyRemoval" name="test_authpolicy_deletion_revokes_access" time="4.996" /><testcase classname="test.e2e.tests.test_negative_security.TestMissingModelRef" name="test_subscription_with_nonexistent_model_ref" time="0.977" /><testcase classname="test.e2e.tests.test_negative_security.TestMissingModelRef" name="test_authpolicy_with_nonexistent_model_ref" time="0.635" /><testcase classname="test.e2e.tests.test_negative_security.TestHeaderAbuse" name="test_special_characters_in_subscription_header" time="0.185" /><testcase classname="test.e2e.tests.test_negative_security.TestWebhookValidation" name="test_subscription_rejected_in_unlabeled_namespace" time="6.260" /><testcase classname="test.e2e.tests.test_negative_security.TestWebhookValidation" name="test_authpolicy_rejected_in_unlabeled_namespace" time="6.256" /><testcase classname="test.e2e.tests.test_subscription.TestAuthEnforcement" name="test_authorized_user_gets_200" time="0.076" /><testcase classname="test.e2e.tests.test_subscription.TestAuthEnforcement" name="test_no_auth_gets_401" time="0.024" /><testcase classname="test.e2e.tests.test_subscription.TestAuthEnforcement" name="test_invalid_token_gets_403" time="0.023" /><testcase classname="test.e2e.tests.test_subscription.TestAuthEnforcement" name="test_wrong_group_gets_403" time="0.046" /><testcase classname="test.e2e.tests.test_subscription.TestAPIKeySubscriptionBinding" name="test_create_api_key_uses_highest_priority_subscription" time="0.287" /><testcase classname="test.e2e.tests.test_subscription.TestAPIKeySubscriptionBinding" name="test_create_api_key_with_explicit_simulator_subscription" time="0.064" /><testcase classname="test.e2e.tests.test_subscription.TestAPIKeySubscriptionBinding" name="test_create_api_key_nonexistent_subscription_errors" time="0.243" /><testcase classname="test.e2e.tests.test_subscription.TestSubscriptionEnforcement" name="test_subscribed_user_gets_200" time="0.033" /><testcase classname="test.e2e.tests.test_subscription.TestSubscriptionEnforcement" name="test_auth_pass_no_subscription_gets_403" time="16.406" /><testcase classname="test.e2e.tests.test_subscription.TestSubscriptionEnforcement" name="test_rate_limit_exhaustion_gets_429" time="25.708" /><testcase classname="test.e2e.tests.test_subscription.TestSubscriptionEnforcement" name="test_models_endpoint_exempt_from_rate_limiting" time="25.342" /><testcase classname="test.e2e.tests.test_subscription.TestMultipleSubscriptionsPerModel" name="test_user_in_one_of_two_subscriptions_gets_200" time="8.415" /><testcase classname="test.e2e.tests.test_subscription.TestMultipleAuthPoliciesPerModel" name="test_two_auth_policies_or_logic" time="16.821"><failure message="RuntimeError: Failed to create API key: 500">self = &lt;test_subscription.TestMultipleAuthPoliciesPerModel object at 0x7f009d5fc3d0&gt;

    def test_two_auth_policies_or_logic(self):
        """Two auth policies for the premium model with OR logic: user matching either gets access."""
        ns = _ns()
        try:
            # Create a 2nd auth policy that allows system:authenticated (user's actual group)
            _apply_cr({
                "apiVersion": "maas.opendatahub.io/v1alpha1",
                "kind": "MaaSAuthPolicy",
                "metadata": {"name": "e2e-premium-sa-auth", "namespace": ns},
                "spec": {
                    "modelRefs": [{"name": PREMIUM_MODEL_REF, "namespace": MODEL_NAMESPACE}],
                    "subjects": {"groups": [{"name": "system:authenticated"}]},
                },
            })
            # Create a subscription for system:authenticated on premium model
            _apply_cr({
                "apiVersion": "maas.opendatahub.io/v1alpha1",
                "kind": "MaaSSubscription",
                "metadata": {"name": "e2e-premium-sa-sub", "namespace": ns},
                "spec": {
                    "owner": {"groups": [{"name": "system:authenticated"}]},
                    "modelRefs": [{"name": PREMIUM_MODEL_REF, "namespace": MODEL_NAMESPACE, "tokenRateLimits": [{"limit": 100, "window": "1m"}]}],
                },
            })
            _wait_reconcile()
    
            # Key must be minted for the premium subscription
&gt;           api_key = _create_api_key(
                _get_cluster_token(),
                name=f"e2e-premium-sa-{uuid.uuid4().hex[:8]}",
                subscription="e2e-premium-sa-sub",
            )

test/e2e/tests/test_subscription.py:720: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

oc_token = 'eyJhbGciOiJSUzI1NiIsImtpZCI6IkFxdGlBMlJMeWRsUkFYUlR2cmRQODZKd2NlbjRuSzNKcTlSclg0UkZJcDQifQ.eyJhdWQiOlsiaHR0cHM6Ly9wcm...eouWt2L7aoQATtZh9z8kfqLUHyIE4uJzadJqdPMxlBz8e6ENYZbLgpVj9zbcnPUatiJ6wdhxG013vhyWiPfyg9iy_ELqAuyRAoYOjc1zmedZm8924QEGNg'
name = 'e2e-premium-sa-7e27ca83', subscription = 'e2e-premium-sa-sub'

    def _create_api_key(oc_token: str, name: str = None, subscription: str = None) -&gt; str:
        """Create an API key using the MaaS API and return the plaintext key.
    
        Args:
            oc_token: OC token for authentication with maas-api
            name: Optional name for the key (auto-generated if not provided)
            subscription: Optional MaaSSubscription name to bind (highest-priority auto-bind if omitted)
    
        Returns:
            The plaintext API key (sk-oai-xxx format)
        """
        r = _create_api_key_raw(oc_token, name, subscription)
        if r.status_code not in (200, 201):
&gt;           raise RuntimeError(f"Failed to create API key: {r.status_code} {r.text}")
E           RuntimeError: Failed to create API key: 500

test/e2e/tests/test_helper.py:243: RuntimeError</failure></testcase><testcase classname="test.e2e.tests.test_subscription.TestMultipleAuthPoliciesPerModel" name="test_delete_one_auth_policy_other_still_works" time="46.966" /><testcase classname="test.e2e.tests.test_subscription.TestCascadeDeletion" name="test_delete_subscription_rebuilds_trlp" time="8.525" /><testcase classname="test.e2e.tests.test_subscription.TestCascadeDeletion" name="test_trlp_persists_during_multi_subscription_deletion" time="33.388" /><testcase classname="test.e2e.tests.test_subscription.TestCascadeDeletion" name="test_delete_last_subscription_denies_access" time="8.516" /><testcase classname="test.e2e.tests.test_subscription.TestCascadeDeletion" name="test_unconfigured_model_denied_by_gateway_auth" time="0.501" /><testcase classname="test.e2e.tests.test_subscription.TestOrderingEdgeCases" name="test_subscription_before_auth_policy" time="19.030" /><testcase classname="test.e2e.tests.test_subscription.TestManagedAnnotation" name="test_authpolicy_managed_false_prevents_update" time="21.345" /><testcase classname="test.e2e.tests.test_subscription.TestManagedAnnotation" name="test_trlp_managed_false_prevents_update" time="18.041" /><testcase classname="test.e2e.tests.test_subscription.TestE2ESubscriptionFlow" name="test_e2e_with_both_access_and_subscription_gets_200" time="9.988"><failure message="RuntimeError: Failed to create API key: 500">self = &lt;test_subscription.TestE2ESubscriptionFlow object at 0x7f009d683490&gt;

    def test_e2e_with_both_access_and_subscription_gets_200(self):
        """
        Full E2E test: Create MaaSModelRef, MaaSAuthPolicy, and MaaSSubscription from scratch.
        API key with both access and subscription should get 200 OK.
    
        This is the comprehensive test that validates the complete E2E flow including
        MaaSModelRef creation and reconciliation. Other tests use existing models for speed.
        """
        ns = _ns()
        model_ref = "e2e-test-model-success"
        auth_policy_name = "e2e-test-auth-success"
        subscription_name = "e2e-test-subscription-success"
        sa_name = "e2e-sa-success"
    
        try:
            # Create service account and get OC token for maas-api
            oc_token = _create_sa_token(sa_name, namespace=ns)
            sa_user = _sa_to_user(sa_name, namespace=ns)
    
            # Create model and governance resources together so the model
            # can reach Ready (requires MaaSSubscription + MaaSAuthPolicy).
            _create_test_maas_model(model_ref)
            _create_test_auth_policy(auth_policy_name, model_ref, users=[sa_user])
            _create_test_subscription(subscription_name, model_ref, users=[sa_user])
    
            endpoint = _wait_for_maas_model_ready(model_ref, timeout=120)
    
            # Extract path from endpoint (e.g., https://maas.../llm/facebook-opt-125m-simulated -&gt; /llm/facebook-opt-125m-simulated)
            model_path = urlparse(endpoint).path
    
            # API key bound to this subscription at mint (inference does not send x-maas-subscription)
&gt;           api_key = _create_api_key(
                oc_token, name=f"{sa_name}-key", subscription=subscription_name
            )

test/e2e/tests/test_subscription.py:1320: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

oc_token = 'eyJhbGciOiJSUzI1NiIsImtpZCI6IkFxdGlBMlJMeWRsUkFYUlR2cmRQODZKd2NlbjRuSzNKcTlSclg0UkZJcDQifQ.eyJhdWQiOlsiaHR0cHM6Ly9wcm...6_BSkHct53OLf_eElMHUEG7NVo_PprxEUPskGwPShS15Mim50btaJNLM02sVKz65yZtTLQw9RpCOY3Qu6lHY08bPKi0NXZAm-pxpZFXCWLFOpIbQECN8gw'
name = 'e2e-sa-success-key', subscription = 'e2e-test-subscription-success'

    def _create_api_key(oc_token: str, name: str = None, subscription: str = None) -&gt; str:
        """Create an API key using the MaaS API and return the plaintext key.
    
        Args:
            oc_token: OC token for authentication with maas-api
            name: Optional name for the key (auto-generated if not provided)
            subscription: Optional MaaSSubscription name to bind (highest-priority auto-bind if omitted)
    
        Returns:
            The plaintext API key (sk-oai-xxx format)
        """
        r = _create_api_key_raw(oc_token, name, subscription)
        if r.status_code not in (200, 201):
&gt;           raise RuntimeError(f"Failed to create API key: {r.status_code} {r.text}")
E           RuntimeError: Failed to create API key: 500

test/e2e/tests/test_helper.py:243: RuntimeError</failure></testcase><testcase classname="test.e2e.tests.test_subscription.TestE2ESubscriptionFlow" name="test_e2e_with_access_but_no_subscription_gets_403" time="9.563"><failure message="RuntimeError: Failed to create API key: 500">self = &lt;test_subscription.TestE2ESubscriptionFlow object at 0x7f009d683190&gt;

    def test_e2e_with_access_but_no_subscription_gets_403(self):
        """
        Test: User with access (MaaSAuthPolicy) but not in any subscription gets 403.
        Uses existing model (facebook-opt-125m-simulated) for faster execution.
    
        Note: We temporarily remove simulator-subscription to ensure the test user
        has auth but no matching subscriptions.
        """
        ns = _ns()
        auth_policy_name = "e2e-test-auth-no-sub"
        sa_name = "e2e-sa-no-sub"
    
        # Snapshot existing subscription to restore later
        original_sim = _snapshot_cr("maassubscription", SIMULATOR_SUBSCRIPTION)
    
        try:
            # Create service account and get OC token for maas-api
            oc_token = _create_sa_token(sa_name, namespace=ns)
            sa_user = _sa_to_user(sa_name, namespace=ns)
    
            # Create auth policy for this specific user
            _create_test_auth_policy(auth_policy_name, MODEL_REF, users=[sa_user])
    
            # Bind simulator subscription on the key while the CR still exists, then remove it
&gt;           api_key = _create_api_key(
                oc_token,
                name=f"{sa_name}-key",
                subscription=SIMULATOR_SUBSCRIPTION,
            )

test/e2e/tests/test_subscription.py:1360: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

oc_token = 'eyJhbGciOiJSUzI1NiIsImtpZCI6IkFxdGlBMlJMeWRsUkFYUlR2cmRQODZKd2NlbjRuSzNKcTlSclg0UkZJcDQifQ.eyJhdWQiOlsiaHR0cHM6Ly9wcm...CFpFOifpt2DZhCCgXk8Okfx8VZyibAbTEdUW5F-TAHXFDCDJ5avmoB8E6WOwq9RqUrMl9-v65kI2Jxr3U4wuJEKN841ZKehoH2NPSsOS_Q0cSeAdvub-8A'
name = 'e2e-sa-no-sub-key', subscription = 'simulator-subscription'

    def _create_api_key(oc_token: str, name: str = None, subscription: str = None) -&gt; str:
        """Create an API key using the MaaS API and return the plaintext key.
    
        Args:
            oc_token: OC token for authentication with maas-api
            name: Optional name for the key (auto-generated if not provided)
            subscription: Optional MaaSSubscription name to bind (highest-priority auto-bind if omitted)
    
        Returns:
            The plaintext API key (sk-oai-xxx format)
        """
        r = _create_api_key_raw(oc_token, name, subscription)
        if r.status_code not in (200, 201):
&gt;           raise RuntimeError(f"Failed to create API key: {r.status_code} {r.text}")
E           RuntimeError: Failed to create API key: 500

test/e2e/tests/test_helper.py:243: RuntimeError</failure></testcase><testcase classname="test.e2e.tests.test_subscription.TestE2ESubscriptionFlow" name="test_e2e_with_subscription_but_no_access_gets_403" time="18.076"><failure message="RuntimeError: Failed to create API key: 500">self = &lt;test_subscription.TestE2ESubscriptionFlow object at 0x7f009d683760&gt;

    def test_e2e_with_subscription_but_no_access_gets_403(self):
        """
        Test: User with subscription but not in auth policy gets 403 Forbidden.
        Uses existing model (facebook-opt-125m-simulated) for faster execution.
    
        Note: Temporarily removes simulator-access to ensure the test user truly
        has no auth (otherwise they'd match via system:authenticated group).
        """
        ns = _ns()
        auth_policy_name = "e2e-test-auth-no-access"
        subscription_name = "e2e-test-subscription-no-access"
        sa_with_auth = "e2e-sa-with-auth"
        sa_with_sub = "e2e-sa-with-sub"
    
        # Snapshot existing auth policy to restore later
        original_access = _snapshot_cr("maasauthpolicy", SIMULATOR_ACCESS_POLICY)
    
        try:
            # Create two service accounts:
            # - sa_with_auth: in auth policy (so the policy exists)
            # - sa_with_sub: in subscription but NOT in auth policy
            _ = _create_sa_token(sa_with_auth, namespace=ns)  # SA creation only - token unused
            oc_token_with_sub = _create_sa_token(sa_with_sub, namespace=MODEL_NAMESPACE)  # Different namespace
    
            sa_with_auth_user = _sa_to_user(sa_with_auth, namespace=ns)
            sa_with_sub_user = _sa_to_user(sa_with_sub, namespace=MODEL_NAMESPACE)
    
            # Delete simulator-access so system:authenticated doesn't grant auth
            _delete_cr("maasauthpolicy", SIMULATOR_ACCESS_POLICY)
    
            # Create test-specific auth/subscription
            _create_test_auth_policy(auth_policy_name, MODEL_REF, users=[sa_with_auth_user])
            _create_test_subscription(subscription_name, MODEL_REF, users=[sa_with_sub_user])
    
            _wait_reconcile()
    
&gt;           api_key_with_sub = _create_api_key(
                oc_token_with_sub,
                name=f"{sa_with_sub}-key",
                subscription=subscription_name,
            )

test/e2e/tests/test_subscription.py:1417: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

oc_token = 'eyJhbGciOiJSUzI1NiIsImtpZCI6IkFxdGlBMlJMeWRsUkFYUlR2cmRQODZKd2NlbjRuSzNKcTlSclg0UkZJcDQifQ.eyJhdWQiOlsiaHR0cHM6Ly9wcm...TelwCVyZJUAH2p6XsYaacoJDjkxKuv7QssUH4bceZpV-LJPxTKZrn0UhNC-CNHAiP6PLpEHCs1meQ9KvPr2KbWyZMjSGcLp4ndF4LbCbwg9vpXONCH0LUA'
name = 'e2e-sa-with-sub-key', subscription = 'e2e-test-subscription-no-access'

    def _create_api_key(oc_token: str, name: str = None, subscription: str = None) -&gt; str:
        """Create an API key using the MaaS API and return the plaintext key.
    
        Args:
            oc_token: OC token for authentication with maas-api
            name: Optional name for the key (auto-generated if not provided)
            subscription: Optional MaaSSubscription name to bind (highest-priority auto-bind if omitted)
    
        Returns:
            The plaintext API key (sk-oai-xxx format)
        """
        r = _create_api_key_raw(oc_token, name, subscription)
        if r.status_code not in (200, 201):
&gt;           raise RuntimeError(f"Failed to create API key: {r.status_code} {r.text}")
E           RuntimeError: Failed to create API key: 500

test/e2e/tests/test_helper.py:243: RuntimeError</failure></testcase></testsuite></testsuites>