Commit 7ee6686b authored by wutu's avatar wutu

优化utils中的测试类

parent 028a177e
Pipeline #11 passed with stage
in 0 seconds
...@@ -38,7 +38,9 @@ public class DockerServiceTests { ...@@ -38,7 +38,9 @@ public class DockerServiceTests {
@Test @Test
public void testSudo() { public void testSudo() {
String result = linuxCtlService.runCmd("ovs-vsctl show"); String result = linuxCtlService.runCmd("ovs-vsctl show");
System.out.println(result); if("".equals(result) || result.toLowerCase().contains("error")) {
Assert.fail(result);
}
} }
/*@Test /*@Test
...@@ -53,7 +55,6 @@ public class DockerServiceTests { ...@@ -53,7 +55,6 @@ public class DockerServiceTests {
@Test @Test
public void testRunDockerService() { public void testRunDockerService() {
DockerContainer container = new DockerContainer(); DockerContainer container = new DockerContainer();
List<String> names = new ArrayList<String>();
container.setName("Router4"); container.setName("Router4");
container.setImage("joliu/networktest"); container.setImage("joliu/networktest");
container.setCommand("sh"); container.setCommand("sh");
...@@ -61,7 +62,7 @@ public class DockerServiceTests { ...@@ -61,7 +62,7 @@ public class DockerServiceTests {
DockerContainer dockerContainer = dockerService.runDocker(container); DockerContainer dockerContainer = dockerService.runDocker(container);
Assert.assertTrue(dockerService.deleteDockerById(dockerContainer.getId())); Assert.assertTrue(dockerService.deleteDockerById(dockerContainer.getId()));
} catch (RuntimeException ex) { } catch (RuntimeException ex) {
Assert.assertEquals("Run Docker failed!", ex.getMessage()); Assert.fail(ex.getMessage());
} }
} }
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment