Skip to content

Add reconciler test asserting SecurityPolicy.spec.oidc.provider has Token on in-cluster URL and Authorization on public URL #113

@dcmcand

Description

@dcmcand

Context

PR #111 added unit tests on `KeycloakProvider.GetEndpointOverrides` covering the struct values it returns. The reconciler-level test (`TestBuildSecurityPolicySpec` in `internal/controller/reconcilers/auth/reconciler_test.go`) does not currently exercise the split-endpoint behavior end-to-end.

Ask

Add a reconciler test that builds a `SecurityPolicy` via `buildSecurityPolicySpec` with a `KeycloakProvider` configured with both internal service config and `KEYCLOAK_EXTERNAL_URL`, and asserts:

  • `spec.OIDC.Provider.TokenEndpoint` host equals the in-cluster service hostname
  • `spec.OIDC.Provider.AuthorizationEndpoint` host equals the `ExternalURL` host
  • `spec.OIDC.Provider.EndSessionEndpoint` host equals the `ExternalURL` host

Catches future regressions where the override-application logic in `reconciler.go` gets refactored without touching `keycloak_test.go`.

Reference

Stylistic note from code review of #111.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions