From 16d0eccc59f80fb9566671356c1ec9fd9519997a Mon Sep 17 00:00:00 2001 From: yixinglu <2520865+yixinglu@users.noreply.github.com> Date: Wed, 29 Sep 2021 09:57:02 +0800 Subject: [PATCH] Fix containerized test --- .github/workflows/nightly.yml | 2 +- .github/workflows/pull_request.yml | 6 +++--- tests/Makefile | 4 +++- tests/common/nebula_service.py | 10 +++++++++- tests/nebula-test-run.py | 7 ++++++- 5 files changed, 22 insertions(+), 7 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 503a919cad7..65a92938b71 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -129,7 +129,7 @@ jobs: timeout-minutes: 20 - name: Setup cluster run: | - make ENABLE_SSL=true CA_SIGNED=true up + make CONTAINERIZED=true ENABLE_SSL=true CA_SIGNED=true up working-directory: tests/ timeout-minutes: 2 - name: Pytest diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index e3dbbe9b9bd..815be3ed081 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -132,17 +132,17 @@ jobs: case ${{ matrix.os }} in centos7) # normal cluster - make up + make CONTAINERIZED=true up ;; ubuntu2004) # ssl cluster - make ENABLE_SSL=true CA_SIGNED=true up + make CONTAINERIZED=true ENABLE_SSL=true CA_SIGNED=true up ;; esac ;; clang-*) # graph ssl only cluster - make ENABLE_SSL=false ENABLE_GRAPH_SSL=true up + make CONTAINERIZED=true ENABLE_SSL=false ENABLE_GRAPH_SSL=true up ;; esac working-directory: tests/ diff --git a/tests/Makefile b/tests/Makefile index 1898894986a..776cb227fe9 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -19,6 +19,7 @@ ENABLE_SSL ?= false ENABLE_GRAPH_SSL ?= false ENABLE_META_SSL ?= false CA_SIGNED ?= false +CONTAINERIZED ?= false # commands gherkin_fmt = ~/.local/bin/reformat-gherkin @@ -65,7 +66,8 @@ up: clean --enable_ssl=$(ENABLE_SSL) \ --enable_graph_ssl=$(ENABLE_GRAPH_SSL) \ --enable_meta_ssl=$(ENABLE_META_SSL) \ - --ca_signed=$(CA_SIGNED) + --ca_signed=$(CA_SIGNED) \ + --containerized=$(CONTAINERIZED) down: $(run_test) --cmd=stop --rm_dir=$(RM_DIR) diff --git a/tests/common/nebula_service.py b/tests/common/nebula_service.py index 1f0e5cb9f28..2a4c6d039e9 100644 --- a/tests/common/nebula_service.py +++ b/tests/common/nebula_service.py @@ -162,7 +162,14 @@ def _check_servers_status(self, ports): time.sleep(1) return False - def start(self, debug_log=True, multi_graphd=False, enable_ssl=False, enable_graph_ssl=False, enable_meta_ssl=False, ca_signed=False): + def start(self, + debug_log=True, + multi_graphd=False, + enable_ssl=False, + enable_graph_ssl=False, + enable_meta_ssl=False, + ca_signed=False, + containerized=False): os.chdir(self.work_dir) metad_ports = self._find_free_port() @@ -203,6 +210,7 @@ def start(self, debug_log=True, multi_graphd=False, enable_ssl=False, enable_gra command += ' --enable_ssl={}'.format(enable_ssl) command += ' --enable_graph_ssl={}'.format(enable_graph_ssl) command += ' --enable_meta_ssl={}'.format(enable_meta_ssl) + command += ' --containerized={}'.format(containerized) print("exec: " + command) p = subprocess.Popen([command], shell=True, stdout=subprocess.PIPE) p.wait() diff --git a/tests/nebula-test-run.py b/tests/nebula-test-run.py index f3c8b8efa09..c39805a6beb 100755 --- a/tests/nebula-test-run.py +++ b/tests/nebula-test-run.py @@ -68,6 +68,10 @@ def init_parser(): dest='ca_signed', default=False, help='Whether enable CA signed SSL/TLS mode.') + opt_parser.add_option('--containerized', + dest='containerized', + default=False, + help='run this process inside container') return opt_parser @@ -92,7 +96,8 @@ def start_nebula(nb, configs): enable_ssl=configs.enable_ssl, enable_graph_ssl=configs.enable_graph_ssl, enable_meta_ssl=configs.enable_meta_ssl, - ca_signed=configs.ca_signed + ca_signed=configs.ca_signed, + containerized=configs.containerized ) # Load csv data