OfficialToolTesting / ExamplesActive

testcontainers-keycloak

dasniko/testcontainers-keycloak ↗

Testcontainers module to run Keycloak in integration tests.Keycloakを統合テストで起動するTestcontainersモジュール

★
464
Forks
63
Contributors
19
Updated
2026-10-11
KC
nightly
License
Apache-2.0

What it can doできること6

  • Start a real Keycloak in Docker from Java integration tests (JUnit 5), with any Keycloak image or version.Javaの統合テスト(JUnit 5)から本物のKeycloakをDockerで起動でき、イメージ・バージョンも指定できる
  • Import realm JSON files, set admin credentials, enable feature flags, set the context path or management port, and pass custom CLI arguments.realm JSONのインポート、管理者認証情報の指定、フィーチャーフラグ、コンテキストパス、管理ポート、任意のCLI引数を設定できる
  • Hand you a ready-made Admin Client, OIDC endpoint URL helpers and token helpers (password and client-credentials grants).設定済みのAdminクライアント、OIDCエンドポイントURLのヘルパー、トークン取得ヘルパー(パスワード/クライアントクレデンシャル)を提供
  • Run with TLS (built-in keystore, or your own cert/key or keystore), in production mode, or from a pre-built --optimized image.TLS(同梱キーストア、独自の証明書/鍵やキーストア)、本番モード、ビルド済みの --optimized イメージでも起動できる
  • Test your own extensions straight from target/classes (packaged on the fly) with third-party libraries and a remote debugger.自作拡張を target/classes から直接テストできる(その場でJAR化)。サードパーティライブラリの追加やリモートデバッグも可能
  • Has integration guides for Spring Boot (@DynamicPropertySource) and Quarkus.Spring Boot(@DynamicPropertySource)とQuarkus向けの統合ガイドがある

What it cannot do / limitsできないこと・制約5

  • Not a Keycloak extension — a Java test library that needs Docker.Keycloak拡張ではなく、Dockerが必要なJava向けテストライブラリ
  • Forward-only development — no LTS and no backports.前方開発のみで、LTSやバックポートはない
  • The default constructor is deprecated (since 4.2) — always pass an image name.デフォルトコンストラクタは4.2から非推奨。必ずイメージ名を指定する
  • An --optimized image without the health endpoint never becomes healthy unless you supply your own wait strategy.--optimized イメージでhealthエンドポイントを有効にしていないと、待機戦略を自分で用意しない限りhealthyにならない
  • Custom CLI arguments are your own responsibility (the library logs a warning).独自のCLI引数を使った場合の動作は自己責任(ライブラリが警告を出す)

Requirements前提条件