fix test that fails with port already in use error
This commit is contained in:
@@ -1,14 +1,29 @@
|
|||||||
package org.springframework.cloud.launcher.kafka;
|
package org.springframework.cloud.launcher.kafka;
|
||||||
|
|
||||||
|
import org.junit.AfterClass;
|
||||||
|
import org.junit.BeforeClass;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
import org.springframework.util.SocketUtils;
|
||||||
|
|
||||||
@RunWith(SpringRunner.class)
|
@RunWith(SpringRunner.class)
|
||||||
@SpringBootTest
|
@SpringBootTest
|
||||||
public class DeployerApplicationTests {
|
public class DeployerApplicationTests {
|
||||||
|
|
||||||
|
@BeforeClass
|
||||||
|
public static void before() {
|
||||||
|
System.setProperty("kafka.port", String.valueOf(SocketUtils.findAvailableTcpPort()));
|
||||||
|
System.setProperty("zk.port", String.valueOf(SocketUtils.findAvailableTcpPort()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@AfterClass
|
||||||
|
public static void after() {
|
||||||
|
System.clearProperty("kafka.port");
|
||||||
|
System.clearProperty("zk.port");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void contextLoads() {
|
public void contextLoads() {
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user