testcontainers / testcontainers/testcontainers-python

Bug: Keycloak container fails with 'HTTPS required'

Offen
#850 7 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
Python
Sterne
2.3k
Forks
386
Ø Merge
4 Std. 40 Min.
Gemergte PRs (30 T.)
1

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit modules/keycloak/testcontainers/keycloak/init.py und modules/keycloak/example_basic.py und reproduziere dann den Fehler mit Keycloak 25.0.4 und python-keycloak 5.6.0. Prüfe die im Issue verlinkte Keycloak README und ermittle, ob die funktionierende Einrichtung Änderungen an der Konfiguration oder Dokumentation erfordert; abgeschlossen ist die Aufgabe, wenn das einfache Beispiel erfolgreich ausgeführt wird und die erforderliche Einrichtung klar ist.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
docker, python
Bereich
authentication, testing
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.