简体   繁体   English

Testcontainers MS SQL Server Module 一直在循环,从不进入测试

[英]Testcontainers MS SQL Server Module stays in a loop and never enters the test

I'm writting a JUnit4 test case with the following:我正在编写一个包含以下内容的 JUnit4 测试用例:

@Rule
public MSSQLServerContainer mssqlserver = new MSSQLServerContainer().acceptLicense();

@Before
public void setUp() throws Exception
{
   url = mssqlserver.getJdbcUrl();
}
@Test
public void someTestMethod() {
...

But it hangs a long time and then this exception is thrown:但是它挂了很长时间然后抛出了这个异常:

java.lang.IllegalStateException: Container is started, but cannot be accessed by (JDBC URL: jdbc:sqlserver://localhost:51772), please check container logs java.lang.IllegalStateException: Container is started, but cannot accessed by (JDBC URL: jdbc:sqlserver://localhost:51772),请检查容器日志

What's wrong?怎么了?

I'm using these dependencies:我正在使用这些依赖项:

testImplementation "org.testcontainers:testcontainers:1.16.3"
testImplementation "org.testcontainers:mssqlserver:1.16.3"

It looks like there's a fix on the way [1].看起来有一个修复方法 [1]。 I had to use the workaround of我不得不使用解决方法

      .withUrlParam("trustServerCertificate", "true")

mentioned there with testcontainers 1.16.3.在那里提到了 testcontainers 1.16.3。

[1] https://github.com/testcontainers/testcontainers-java/issues/5032 [1] https://github.com/testcontainers/testcontainers-java/issues/5032

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM