|
|
@@ -1,6 +1,10 @@
|
|
|
import cn.reghao.devops.common.build.model.constant.RepoAuthType;
|
|
|
import cn.reghao.devops.common.build.tool.repo.GitImpl;
|
|
|
+import cn.reghao.devops.common.docker.DockerImpl;
|
|
|
+import cn.reghao.devops.common.ws.WsClient;
|
|
|
import cn.reghao.devops.manager.app.model.po.config.build.RepoAuthConfig;
|
|
|
+import com.github.dockerjava.api.command.InspectContainerResponse;
|
|
|
+import com.github.dockerjava.api.model.Container;
|
|
|
import org.junit.Test;
|
|
|
|
|
|
import java.util.List;
|
|
|
@@ -25,11 +29,41 @@ public class BuildTest {
|
|
|
}
|
|
|
|
|
|
@Test
|
|
|
- public void dockerTest() {
|
|
|
+ public void dockerListTest() {
|
|
|
Pattern pattern = Pattern.compile("^\\S*$");
|
|
|
String str = "dfa safd";
|
|
|
String str1 = "dfasafd";
|
|
|
boolean matched = pattern.matcher(str).matches();
|
|
|
System.out.println();
|
|
|
}
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void dockerBuildTest() throws Exception {
|
|
|
+ DockerImpl docker = new DockerImpl();
|
|
|
+ String repoTag = "file:12345678";
|
|
|
+ String compileHome = "/home/reghao/code/aha/tnb/file/file-service";
|
|
|
+ docker.build(repoTag, compileHome);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void dockerTest() {
|
|
|
+ DockerImpl docker = new DockerImpl();
|
|
|
+ InspectContainerResponse containerInfo = docker.ps("dnkt-admin");
|
|
|
+
|
|
|
+ List<Container> list = docker.ps(true);
|
|
|
+ list.forEach(container -> {
|
|
|
+ container.getId();
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void wsTest() throws InterruptedException {
|
|
|
+ String url = "wss://devops.reghao.cn/ws/log/pull?token=12345678";
|
|
|
+ url = "wss://devops.reghao.cn/ws/message?token=12345678";
|
|
|
+
|
|
|
+ WsClient wsClient = new WsClient(url);
|
|
|
+ wsClient.connect();
|
|
|
+
|
|
|
+ Thread.sleep(3600_000);
|
|
|
+ }
|
|
|
}
|