testcontainers / testcontainers/testcontainers-python
Bug: MSSQL (SqlServerContainer) ignores some parameters
Nessuno ha ancora preso questa issue.
- Lingua principale
- Python
- Stelle
- 2.3k
- Fork
- 386
- Merge medio
- 4h 40m
- PR unite (30g)
- 1
Descrizione
Describe the bug
When running the SqlServerContainer, in this example with the image mcr.microsoft.com/mssql/server:2022-CU12-ubuntu-22.04, some parameters have no effect on the actual database and lead to failures. It seems like they are just not respected.
To Reproduce
import sqlalchemy
from testcontainers.mssql import SqlServerContainer
def test_showcase_bug():
with SqlServerContainer(image="mcr.microsoft.com/mssql/server:2022-CU12-ubuntu-22.04", username="dummy") as mssql:
engine = sqlalchemy.create_engine(mssql.get_connection_url()) # this includes the username "dummy" now.
print(mssql.get_connection_url())
with engine.begin() as connection:
result = connection.execute(sqlalchemy.text("select @@VERSION"))
It loads a while. When looking at the database logs, it prints:
2024-11-14 10:39:43.81 Logon Error: 18456, Severity: 14, State: 5.
2024-11-14 10:39:43.81 Logon Login failed for user 'dummy'. Reason: Could not find a login matching the name provided. [CLIENT: 172.17.0.3]
Same thing for other parameters, for example db_name.
Runtime environment
Provide a summary of your runtime environment. Which operating system, python version, and docker version are you using? What is the version of testcontainers-python you are using? You can run the following commands to get the relevant information.
Windows 11
Python 3.11.9
testcontainers 4.8.2
sqlalchemy 2.0.36
pymssql 2.3.1
Thanks for your work!
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Parti dall’implementazione di SqlServerContainer e riproduci l’esempio con l’immagine MSSQL specificata e i parametri username e db_name. Traccia il modo in cui questi parametri vengono passati al container e all’URL di connessione, quindi verifica che il database in esecuzione li applichi e che l’esempio non fallisca più in fase di autenticazione.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- docker, python, sqlalchemy
- Ambito
- database
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 45/100