You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Azure Pipeline中Testcontainers MSSQL容器启动超时问题求助

问题:Testcontainers在Azure Pipeline中启动MSSQL容器超时(NUnit环境)

我遇到了类似某Stack Overflow帖子的问题,但因声望不足无法评论。我的场景和该帖一致,区别是使用NUnit而非xUnit。Testcontainers MSSQL数据库在可复用的基础夹具中启动,本地运行完全正常,但在Azure Pipeline中卡住超时。

我还做了额外测试:创建控制台应用运行相同容器、连接并执行SELECT 1,本地正常但Azure Pipeline中依旧卡住。

收集到的日志信息

Testcontainers日志

持续重复输出:

Execute "/opt/mssql-tools/bin/sqlcmd -Q SELECT 1;" at Docker container 3e9c900b903c

Docker容器日志

...
2024-07-26 13:05:18.95 spid50s     Database 'msdb' running the upgrade step from version 952 to version 953.

2024-07-26 13:05:18.96 spid50s     Database 'msdb' running the upgrade step from version 953 to version 954.

2024-07-26 13:05:18.97 spid50s     Database 'msdb' running the upgrade step from version 954 to version 955.

2024-07-26 13:05:18.98 spid50s     Database 'msdb' running the upgrade step from version 955 to version 956.

2024-07-26 13:05:19.01 spid50s     Database 'msdb' running the upgrade step from version 956 to version 957.

2024-07-26 13:05:19.05 spid13s     Recovery is complete. This is an informational message only. No user action is required.

2024-07-26 13:05:19.12 spid27s     The default language (LCID 0) has been set for engine and full-text services.

2024-07-26 13:05:19.20 spid27s     The tempdb database has 2 data file(s).

2024-07-26 13:10:16.69 spid62      XE session 'telemetry_xevents' started.

2024-07-26 13:10:44.25 spid62      Attempting to load library 'xplog70.dll' into memory. This is an informational message only. No user action is required.

2024-07-26 13:10:44.29 spid62      Using 'xplog70.dll' version '2022.160.4135' to execute extended stored procedure 'xp_msver'. This is an informational message only; no user action is required.

日志到此处后不再输出,Testcontainers持续重复执行SELECT 1的命令。

容器创建代码

new MsSqlBuilder()
            .WithImage("mcr.microsoft.com/mssql/server:2022-latest")
            .WithCleanUp(true)
            .WithPortBinding(1431)
            .WithPassword("Password123!")
            .WithLogger(new ContainerLogger())
            .Build();

已排查项

  • 检查Azure Pipeline代理的内存使用,无异常
  • 禁用测试并行化,问题依旧

恳请各位提供解决思路。

内容的提问来源于stack exchange,提问作者davor300

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.20 12:24:51