testcontainers / testcontainers/testcontainers-python

Bug: Keycloak container fails with 'HTTPS required'

未关闭
#850 7 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
Python
星标
2.3k
派生
386
平均合并
4 小时 40 分钟
30 天内合并 PR
1

描述

Describe the bug

The basic example from Keycloak does not run.

There is actually another "solvable" bug that the library python-keycloak does not work on version 5.7.1 due to a missing import (KeycloakClient), and must be downgraded to 5.6.0

To Reproduce

I have used the exact example provided in the source code here:

from testcontainers.keycloak import KeycloakContainer

def test_keycloak_setup():
    with KeycloakContainer(f"quay.io/keycloak/keycloak:25.0.4") as keycloak:
        counts = keycloak.get_client().users_count()
        print(counts)

I have also tried the example on the repo example_basic.py, and this one also does not run, but fails early since the API for the library has changed.

I understand that keycloak is sometimes a pain to setup with insecure options, and probably it needs extra options, but it's unclear from the docs that that is the case. Docs here:

https://testcontainers-python.readthedocs.io/en/latest/modules/keycloak/README.html

I could offer my help to tackle the issue for a working solution, the question is if the change is for documentation (keycloak is not expected to work out of the box) or configuration. It's also possible that it needs a realm import.

Runtime environment

# Get the operating system information (on a unix os).
$ uname -a
Darwin
# Get the python version.
$ python --version
3.10.11
# Get the docker version and other docker information.
$ docker info
Client:
 Version:    28.3.2
 Context:    desktop-linux
 Debug Mode: false
# Get all python packages.
$ pip freeze
testcontainers==4.12.0
python-keycloak==5.6.0

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 modules/keycloak/testcontainers/keycloak/init.py 和 modules/keycloak/example_basic.py 开始,然后使用 Keycloak 25.0.4 和 python-keycloak 5.6.0 重现该失败。检查 issue 中链接的 Keycloak README,并确定可正常工作的设置是否需要修改配置或文档;基本示例能够成功运行且所需设置清晰明确即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
docker, python
领域
authentication, testing
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。