Skip to content

Bug: MSSQL Cannot run 'SELECT 1': container is not ready #666

@grieve54706

Description

@grieve54706

Describe the bug

Microsoft changes the mssql-tools folder name to mssql-tools18 at 2019-latest and 2022-latest. Testcontainer could not use the right path to check database status by mssql tool.

status, _ = self.exec(f"/opt/mssql-tools/bin/sqlcmd -U {self.username} -P {self.password} -Q 'SELECT 1'")

Relate microsoft/mssql-docker#892 (comment)

To Reproduce

from testcontainers.mssql import SqlServerContainer

mssql = SqlServerContainer("mcr.microsoft.com/mssql/server:2019-latest").start()

Solution
We need to determine the exact location of the MSSQL tool before utilizing it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions