diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 91f3ee1b1..7070f4688 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -40,7 +40,32 @@ jobs: pushd nebula-docker-compose/ cp ../../client/src/test/resources/docker-compose.yaml . docker-compose up -d - sleep 10 + sleep 30 + docker-compose ps + popd + popd + + - name: Install nebula-graph with CA SSL + run: | + pushd tmp + mkdir ca + pushd ca + cp ../../client/src/test/resources/docker-compose-casigned.yaml . + docker-compose -f docker-compose-casigned.yaml up -d + sleep 30 + docker-compose -f docker-compose-casigned.yaml ps + popd + popd + + - name: Install nebula-graph with Self SSL + run: | + pushd tmp + mkdir self + pushd self + cp ../../client/src/test/resources/docker-compose-selfsigned.yaml . + docker-compose -f docker-compose-selfsigned.yaml up -d + sleep 30 + docker-compose -f docker-compose-selfsigned.yaml ps popd popd diff --git a/client/src/test/java/com/vesoft/nebula/client/graph/data/TestDataFromServer.java b/client/src/test/java/com/vesoft/nebula/client/graph/data/TestDataFromServer.java index 0718e985c..5140f7e0c 100644 --- a/client/src/test/java/com/vesoft/nebula/client/graph/data/TestDataFromServer.java +++ b/client/src/test/java/com/vesoft/nebula/client/graph/data/TestDataFromServer.java @@ -555,9 +555,6 @@ public void testSelfSignedSsl() { Session sslSession = null; NebulaPool sslPool = new NebulaPool(); try { - Runtime runtime = Runtime.getRuntime(); - runtime.exec("docker-compose -f src/test/resources/docker-compose" - + "-selfsigned.yaml up -d"); NebulaPoolConfig nebulaSslPoolConfig = new NebulaPoolConfig(); nebulaSslPoolConfig.setMaxConnSize(100); @@ -566,8 +563,7 @@ public void testSelfSignedSsl() { "src/test/resources/ssl/selfsigned.pem", "src/test/resources/ssl/selfsigned.key", "vesoft")); - TimeUnit.SECONDS.sleep(45); - Assert.assertTrue(sslPool.init(Arrays.asList(new HostAddress("127.0.0.1", 8669)), + Assert.assertTrue(sslPool.init(Arrays.asList(new HostAddress("127.0.0.1", 7669)), nebulaSslPoolConfig)); sslSession = sslPool.getSession("root", "nebula", true); @@ -577,9 +573,6 @@ public void testSelfSignedSsl() { .getJSONObject(0).getJSONArray("row").toJSONString(); String exp = "[1]"; Assert.assertEquals(rowData, exp); - - runtime.exec("docker-compose -f src/test/resources/docker-compose" - + "-selfsigned.yaml down").waitFor(60, TimeUnit.SECONDS); } catch (Exception e) { e.printStackTrace(); assert false; @@ -596,10 +589,6 @@ public void testCASignedSsl() { Session sslSession = null; NebulaPool sslPool = new NebulaPool(); try { - Runtime runtime = Runtime.getRuntime(); - runtime.exec("docker-compose -f src/test/resources/docker-compose" - + "-casigned.yaml up -d"); - NebulaPoolConfig nebulaSslPoolConfig = new NebulaPoolConfig(); nebulaSslPoolConfig.setMaxConnSize(100); nebulaSslPoolConfig.setEnableSsl(true); @@ -607,7 +596,6 @@ public void testCASignedSsl() { "src/test/resources/ssl/casigned.pem", "src/test/resources/ssl/casigned.crt", "src/test/resources/ssl/casigned.key")); - TimeUnit.SECONDS.sleep(45); Assert.assertTrue(sslPool.init(Arrays.asList(new HostAddress("127.0.0.1", 8669)), nebulaSslPoolConfig)); sslSession = sslPool.getSession("root", "nebula", true); @@ -619,8 +607,6 @@ public void testCASignedSsl() { String exp = "[1]"; Assert.assertEquals(rowData, exp); - runtime.exec("docker-compose -f src/test/resources/docker-compose" - + "-casigned.yaml down").waitFor(60, TimeUnit.SECONDS); } catch (Exception e) { e.printStackTrace(); assert false; diff --git a/client/src/test/java/com/vesoft/nebula/client/meta/MockNebulaGraph.java b/client/src/test/java/com/vesoft/nebula/client/meta/MockNebulaGraph.java index b7496e2e0..1e8585b6f 100644 --- a/client/src/test/java/com/vesoft/nebula/client/meta/MockNebulaGraph.java +++ b/client/src/test/java/com/vesoft/nebula/client/meta/MockNebulaGraph.java @@ -161,7 +161,7 @@ public static void createSpaceWithSelfSSL() { "src/test/resources/ssl/selfsigned.pem", "src/test/resources/ssl/selfsigned.key", "vesoft")); - List addresses = Arrays.asList(new HostAddress("127.0.0.1", 8669)); + List addresses = Arrays.asList(new HostAddress("127.0.0.1", 7669)); NebulaPool pool = new NebulaPool(); Session session = null; try { diff --git a/client/src/test/java/com/vesoft/nebula/client/meta/TestMetaClient.java b/client/src/test/java/com/vesoft/nebula/client/meta/TestMetaClient.java index 34783f06f..8102d67c4 100644 --- a/client/src/test/java/com/vesoft/nebula/client/meta/TestMetaClient.java +++ b/client/src/test/java/com/vesoft/nebula/client/meta/TestMetaClient.java @@ -144,12 +144,8 @@ public void testListOnlineHosts() { public void testCASignedSSLMetaClient() { String startCmd = "docker-compose -f src/test/resources/docker-compose-casigned.yaml up -d"; String stopCmd = "docker-compose -f src/test/resources/docker-compose-casigned.yaml down"; - Runtime runtime = Runtime.getRuntime(); MetaClient metaClient = null; try { - Process p = runtime.exec(startCmd); - p.waitFor(60, TimeUnit.SECONDS); - ProcessUtil.printProcessStatus(startCmd, p); // mock data with CA ssl MockNebulaGraph.createSpaceWithCASSL(); @@ -173,27 +169,12 @@ public void testCASignedSSLMetaClient() { if (metaClient != null) { metaClient.close(); } - try { - Process p = runtime.exec(stopCmd); - p.waitFor(60, TimeUnit.SECONDS); - ProcessUtil.printProcessStatus(stopCmd, p); - } catch (InterruptedException | IOException e) { - e.printStackTrace(); - } } } public void testSelfSignedSSLMetaClient() { - String startCmd = - "docker-compose -f src/test/resources/docker-compose-selfsigned.yaml up -d"; - String stopCmd = "docker-compose -f src/test/resources/docker-compose-selfsigned.yaml down"; - MetaClient metaClient = null; - Runtime runtime = Runtime.getRuntime(); try { - Process p = runtime.exec(startCmd); - p.waitFor(60, TimeUnit.SECONDS); - ProcessUtil.printProcessStatus(startCmd, p); // mock data with Self ssl MockNebulaGraph.createSpaceWithSelfSSL(); @@ -202,7 +183,7 @@ public void testSelfSignedSSLMetaClient() { "src/test/resources/ssl/selfsigned.pem", "src/test/resources/ssl/selfsigned.key", "vesoft"); - metaClient = new MetaClient(Arrays.asList(new HostAddress(address, 8559)), + metaClient = new MetaClient(Arrays.asList(new HostAddress(address, 7559)), 3000, 1, 1, true, sslParam); metaClient.connect(); @@ -216,13 +197,6 @@ public void testSelfSignedSSLMetaClient() { if (metaClient != null) { metaClient.close(); } - try { - Process p = runtime.exec(stopCmd); - p.waitFor(60, TimeUnit.SECONDS); - ProcessUtil.printProcessStatus(stopCmd, p); - } catch (Exception e) { - e.printStackTrace(); - } } } } diff --git a/client/src/test/java/com/vesoft/nebula/client/meta/TestMetaManager.java b/client/src/test/java/com/vesoft/nebula/client/meta/TestMetaManager.java index f993d3f7e..fcb49319d 100644 --- a/client/src/test/java/com/vesoft/nebula/client/meta/TestMetaManager.java +++ b/client/src/test/java/com/vesoft/nebula/client/meta/TestMetaManager.java @@ -121,14 +121,8 @@ public void testMultiVersionSchema() throws ClientServerIncompatibleException { public void testCASignedSSLMetaManager() { - String startCmd = "docker-compose -f src/test/resources/docker-compose-casigned.yaml up -d"; - String stopCmd = "docker-compose -f src/test/resources/docker-compose-casigned.yaml down"; - Runtime runtime = Runtime.getRuntime(); MetaManager metaManager = null; try { - Process p = runtime.exec(startCmd); - p.waitFor(60, TimeUnit.SECONDS); - ProcessUtil.printProcessStatus(startCmd, p); // mock data with CA ssl MockNebulaGraph.createSpaceWithCASSL(); @@ -161,26 +155,12 @@ public void testCASignedSSLMetaManager() { if (metaManager != null) { metaManager.close(); } - try { - Process p = runtime.exec(stopCmd); - p.waitFor(60, TimeUnit.SECONDS); - ProcessUtil.printProcessStatus(stopCmd, p); - } catch (InterruptedException | IOException e) { - e.printStackTrace(); - } } } public void testSelfSignedSSLMetaClient() { - String startCmd = - "docker-compose -f src/test/resources/docker-compose-selfsigned.yaml up -d"; - String stopCmd = "docker-compose -f src/test/resources/docker-compose-selfsigned.yaml down"; - Runtime runtime = Runtime.getRuntime(); MetaManager metaManager = null; try { - Process p = runtime.exec(startCmd); - p.waitFor(60, TimeUnit.SECONDS); - ProcessUtil.printProcessStatus(startCmd, p); // mock data with Self ssl MockNebulaGraph.createSpaceWithSelfSSL(); @@ -189,7 +169,7 @@ public void testSelfSignedSSLMetaClient() { "src/test/resources/ssl/selfsigned.pem", "src/test/resources/ssl/selfsigned.key", "vesoft"); - metaManager = new MetaManager(Arrays.asList(new HostAddress("127.0.0.1", 8559)), + metaManager = new MetaManager(Arrays.asList(new HostAddress("127.0.0.1", 7559)), 3000, 1, 1, true, sslParam); assert (metaManager.getSpaceId("testMeta") > 0); @@ -212,13 +192,6 @@ public void testSelfSignedSSLMetaClient() { if (metaManager != null) { metaManager.close(); } - try { - Process p = runtime.exec(stopCmd); - p.waitFor(60, TimeUnit.SECONDS); - ProcessUtil.printProcessStatus(stopCmd, p); - } catch (InterruptedException | IOException e) { - e.printStackTrace(); - } } } } diff --git a/client/src/test/resources/docker-compose-casigned.yaml b/client/src/test/resources/docker-compose-casigned.yaml index bfdd1b96d..bcce4fc18 100644 --- a/client/src/test/resources/docker-compose-casigned.yaml +++ b/client/src/test/resources/docker-compose-casigned.yaml @@ -6,10 +6,10 @@ services: USER: root TZ: "${TZ}" command: - - --meta_server_addrs=172.29.1.1:8559 + - --meta_server_addrs=172.29.1.1:9559 - --local_ip=172.29.1.1 - --ws_ip=172.29.1.1 - - --port=8559 + - --port=9559 - --data_path=/data/meta - --log_dir=/logs - --v=0 @@ -28,7 +28,7 @@ services: retries: 3 start_period: 20s ports: - - "8559:8559" + - "8559:9559" - 11000 - 11002 volumes: @@ -48,10 +48,10 @@ services: USER: root TZ: "${TZ}" command: - - --meta_server_addrs=172.29.1.1:8559 + - --meta_server_addrs=172.29.1.1:9559 - --local_ip=172.29.2.1 - --ws_ip=172.29.2.1 - - --port=8779 + - --port=9779 - --data_path=/data/storage - --log_dir=/logs - --v=0 @@ -72,7 +72,7 @@ services: retries: 3 start_period: 20s ports: - - "8779:8779" + - "8779:9779" - 12000 - 12002 volumes: @@ -92,8 +92,8 @@ services: USER: root TZ: "${TZ}" command: - - --meta_server_addrs=172.29.1.1:8559 - - --port=8669 + - --meta_server_addrs=172.29.1.1:9559 + - --port=9669 - --ws_ip=172.29.3.1 - --log_dir=/logs - --v=0 @@ -114,7 +114,7 @@ services: retries: 3 start_period: 20s ports: - - "8669:8669" + - "8669:9669" - 13000 - 13002 volumes: diff --git a/client/src/test/resources/docker-compose-selfsigned.yaml b/client/src/test/resources/docker-compose-selfsigned.yaml index aeac1a60a..82d743ad5 100644 --- a/client/src/test/resources/docker-compose-selfsigned.yaml +++ b/client/src/test/resources/docker-compose-selfsigned.yaml @@ -6,10 +6,10 @@ services: USER: root TZ: "${TZ}" command: - - --meta_server_addrs=172.29.1.1:8559 - - --local_ip=172.29.1.1 - - --ws_ip=172.29.1.1 - - --port=8559 + - --meta_server_addrs=172.30.1.1:9559 + - --local_ip=172.30.1.1 + - --ws_ip=172.30.1.1 + - --port=9559 - --data_path=/data/meta - --log_dir=/logs - --v=0 @@ -22,13 +22,13 @@ services: - --password_path=/share/resources/test.ca.password - --enable_ssl=true healthcheck: - test: ["CMD", "curl", "-f", "http://172.29.1.1:11000/status"] + test: ["CMD", "curl", "-f", "http://172.30.1.1:11000/status"] interval: 30s timeout: 10s retries: 3 start_period: 20s ports: - - "8559:8559" + - "7559:9559" - 11000 - 11002 volumes: @@ -37,7 +37,7 @@ services: - ./ssl:/share/resources:Z networks: nebula-net-selfsigned: - ipv4_address: 172.29.1.1 + ipv4_address: 172.30.1.1 restart: on-failure cap_add: - SYS_PTRACE @@ -48,10 +48,10 @@ services: USER: root TZ: "${TZ}" command: - - --meta_server_addrs=172.29.1.1:8559 - - --local_ip=172.29.2.1 - - --ws_ip=172.29.2.1 - - --port=8779 + - --meta_server_addrs=172.30.1.1:9559 + - --local_ip=172.30.2.1 + - --ws_ip=172.30.2.1 + - --port=9779 - --data_path=/data/storage - --log_dir=/logs - --v=0 @@ -66,13 +66,13 @@ services: depends_on: - metad-selfsigned healthcheck: - test: ["CMD", "curl", "-f", "http://172.29.2.1:12000/status"] + test: ["CMD", "curl", "-f", "http://172.30.2.1:12000/status"] interval: 30s timeout: 10s retries: 3 start_period: 20s ports: - - "8779:8779" + - "7779:9779" - 12000 - 12002 volumes: @@ -81,7 +81,7 @@ services: - ./ssl:/share/resources:Z networks: nebula-net-selfsigned: - ipv4_address: 172.29.2.1 + ipv4_address: 172.30.2.1 restart: on-failure cap_add: - SYS_PTRACE @@ -92,9 +92,9 @@ services: USER: root TZ: "${TZ}" command: - - --meta_server_addrs=172.29.1.1:8559 - - --port=8669 - - --ws_ip=172.29.3.1 + - --meta_server_addrs=172.30.1.1:9559 + - --port=9669 + - --ws_ip=172.30.3.1 - --log_dir=/logs - --v=0 - --minloglevel=0 @@ -108,13 +108,13 @@ services: depends_on: - metad-selfsigned healthcheck: - test: ["CMD", "curl", "-f", "http://172.29.3.1:13000/status"] + test: ["CMD", "curl", "-f", "http://172.30.3.1:13000/status"] interval: 30s timeout: 10s retries: 3 start_period: 20s ports: - - "8669:8669" + - "7669:9669" - 13000 - 13002 volumes: @@ -122,7 +122,7 @@ services: - ./ssl:/share/resources:Z networks: nebula-net-selfsigned: - ipv4_address: 172.29.3.1 + ipv4_address: 172.30.3.1 restart: on-failure cap_add: - SYS_PTRACE @@ -132,4 +132,4 @@ networks: ipam: driver: default config: - - subnet: 172.29.0.0/16 + - subnet: 172.30.0.0/16