testcontainers / testcontainers/testcontainers-python

Bug: MSSQL (SqlServerContainer) ignores some parameters

オープン
#736 コメント 2 件 リアクション 1 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
Python
スター
2.3k
フォーク
386
平均マージ
4時間 40分
マージ済み PR(30日)
1

説明

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!

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

SqlServerContainer の実装から始め、指定された MSSQL イメージと username、db_name パラメーターを使って例を再現します。これらのパラメーターがコンテナーと接続 URL にどのように渡されるかを追跡し、実行中のデータベースにそれらが適用され、例で認証エラーが発生しなくなったことを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
docker, python, sqlalchemy
領域
database
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。