From 4db7f7eda3c99ee6fee053be0ba452c3615625b9 Mon Sep 17 00:00:00 2001 From: a1012112796 <1012112796@qq.com> Date: Wed, 17 May 2023 11:53:37 +0800 Subject: [PATCH 1/4] replace `drone exec` to `act_runner exec` in test READEME.md as title, follow #24494, old `drone exec` has broken, suggest replace. Signed-off-by: a1012112796 <1012112796@qq.com> --- .github/workflows/pull-db-tests.yml | 10 +++++----- tests/e2e/README.md | 4 ++-- tests/integration/README.md | 21 +++++++++++++++++++-- tests/integration/README_ZH.md | 20 ++++++++++++++++++-- 4 files changed, 44 insertions(+), 11 deletions(-) diff --git a/.github/workflows/pull-db-tests.yml b/.github/workflows/pull-db-tests.yml index bef1df15154ec..2893049195a77 100644 --- a/.github/workflows/pull-db-tests.yml +++ b/.github/workflows/pull-db-tests.yml @@ -41,7 +41,7 @@ jobs: with: go-version: ">=1.20.0" - name: Add hosts to /etc/hosts - run: echo "127.0.0.1 pgsql ldap minio" | sudo tee -a /etc/hosts + run: '[ -f "/.dockerenv" ] || echo "127.0.0.1 pgsql ldap minio" | sudo tee -a /etc/hosts' - run: make deps-backend - run: make backend env: @@ -119,7 +119,7 @@ jobs: with: go-version: ">=1.20.0" - name: Add hosts to /etc/hosts - run: echo "127.0.0.1 mysql elasticsearch smtpimap" | sudo tee -a /etc/hosts + run: '[ -f "/.dockerenv" ] || echo "127.0.0.1 mysql elasticsearch smtpimap" | sudo tee -a /etc/hosts' - run: make deps-backend - run: make backend env: @@ -166,7 +166,7 @@ jobs: with: go-version: ">=1.20.0" - name: Add hosts to /etc/hosts - run: echo "127.0.0.1 mysql elasticsearch smtpimap" | sudo tee -a /etc/hosts + run: '[ -f "/.dockerenv" ] || echo "127.0.0.1 mysql elasticsearch smtpimap" | sudo tee -a /etc/hosts' - run: make deps-backend - run: make backend env: @@ -195,7 +195,7 @@ jobs: with: go-version: ">=1.20.0" - name: Add hosts to /etc/hosts - run: echo "127.0.0.1 mysql8" | sudo tee -a /etc/hosts + run: '[ -f "/.dockerenv" ] || echo "127.0.0.1 mysql8" | sudo tee -a /etc/hosts' - run: make deps-backend - run: make backend env: @@ -223,7 +223,7 @@ jobs: with: go-version: ">=1.20.0" - name: Add hosts to /etc/hosts - run: echo "127.0.0.1 mssql" | sudo tee -a /etc/hosts + run: '[ -f "/.dockerenv" ] || echo "127.0.0.1 mssql" | sudo tee -a /etc/hosts' - run: make deps-backend - run: make backend env: diff --git a/tests/e2e/README.md b/tests/e2e/README.md index 2d9a0ab8fde35..bf444ddb800e2 100644 --- a/tests/e2e/README.md +++ b/tests/e2e/README.md @@ -22,9 +22,9 @@ npx playwright install-deps ``` -## Run all tests via local drone +## Run all tests via local act_runner ``` -drone exec --local --build-event "pull_request" +act_runner exec -W ./.github/workflows/pull-e2e-tests.yml --event=pull_request --default-actions-url="https://github.com" -i catthehacker/ubuntu:runner-latest ``` ## Run sqlite e2e tests diff --git a/tests/integration/README.md b/tests/integration/README.md index 636949df38f47..e3fabd8e3acf5 100644 --- a/tests/integration/README.md +++ b/tests/integration/README.md @@ -15,9 +15,26 @@ Make sure to perform a clean build before running tests: make clean build ``` -## Run all tests via local drone +## Run tests via local act_runner + +### run all jobs + +``` +act_runner exec -W ./.github/workflows/pull-db-tests.yml --event=pull_request --default-actions-url="https://github.com" -i catthehacker/ubuntu:runner-latest +``` + +Warning: because of many jobs was defined in this file, this operation will +cost too much cpu and memory to run. so not suggest do this. + +### run one job + +```SHELL +act_runner exec -W ./.github/workflows/pull-db-tests.yml --event=pull_request --default-actions-url="https://github.com" -i catthehacker/ubuntu:runner-latest -j ``` -drone exec --local --build-event "pull_request" + +you can can list all job names by: +```SHELL +act_runner exec -W ./.github/workflows/pull-db-tests.yml --event=pull_request --default-actions-url="https://github.com" -i catthehacker/ubuntu:runner-latest -l ``` ## Run sqlite integration tests diff --git a/tests/integration/README_ZH.md b/tests/integration/README_ZH.md index 38402324720bb..a924892f815d9 100644 --- a/tests/integration/README_ZH.md +++ b/tests/integration/README_ZH.md @@ -12,9 +12,25 @@ make test-sqlite make clean build ``` -## 如何在本地 drone 服务器上运行所有测试 +## 如何在本地 act_runner 上运行测试 + +### 运行所有任务 + +``` +act_runner exec -W ./.github/workflows/pull-db-tests.yml --event=pull_request --default-actions-url="https://github.com" -i catthehacker/ubuntu:runner-latest +``` + +警告:由于在此文件中定义了许多任务,因此此操作将花费太多的CPU和内存来运行。所以不建议这样做。 + +### 运行单个任务 + +```SHELL +act_runner exec -W ./.github/workflows/pull-db-tests.yml --event=pull_request --default-actions-url="https://github.com" -i catthehacker/ubuntu:runner-latest -j ``` -drone exec --local --build-event "pull_request" + +您可以通过以下方式列出所有任务名称: +```SHELL +act_runner exec -W ./.github/workflows/pull-db-tests.yml --event=pull_request --default-actions-url="https://github.com" -i catthehacker/ubuntu:runner-latest -l ``` ## 如何使用 sqlite 数据库进行集成测试 From 89ec2a083c975854580563850d2514c30cefc1bf Mon Sep 17 00:00:00 2001 From: a1012112796 <1012112796@qq.com> Date: Thu, 18 May 2023 20:43:23 +0800 Subject: [PATCH 2/4] Apply suggestions from code review Co-authored-by: silverwind --- tests/integration/README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/integration/README.md b/tests/integration/README.md index e3fabd8e3acf5..0845e6726ad6e 100644 --- a/tests/integration/README.md +++ b/tests/integration/README.md @@ -17,22 +17,22 @@ make clean build ## Run tests via local act_runner -### run all jobs +### Run all jobs ``` act_runner exec -W ./.github/workflows/pull-db-tests.yml --event=pull_request --default-actions-url="https://github.com" -i catthehacker/ubuntu:runner-latest ``` -Warning: because of many jobs was defined in this file, this operation will -cost too much cpu and memory to run. so not suggest do this. +Warning: This file defines many jobs, so it will be resource-intensive and therefor not recommended. -### run one job +### Run single job ```SHELL act_runner exec -W ./.github/workflows/pull-db-tests.yml --event=pull_request --default-actions-url="https://github.com" -i catthehacker/ubuntu:runner-latest -j ``` -you can can list all job names by: +You can can list all job names via: + ```SHELL act_runner exec -W ./.github/workflows/pull-db-tests.yml --event=pull_request --default-actions-url="https://github.com" -i catthehacker/ubuntu:runner-latest -l ``` From 28cdb2f52fc5ca2cde6559fb0772f5d8b4431af8 Mon Sep 17 00:00:00 2001 From: a1012112796 <1012112796@qq.com> Date: Thu, 18 May 2023 12:47:03 +0000 Subject: [PATCH 3/4] apply suggestions Signed-off-by: a1012112796 <1012112796@qq.com> --- .github/workflows/pull-db-tests.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pull-db-tests.yml b/.github/workflows/pull-db-tests.yml index 2893049195a77..b3b02f15caf22 100644 --- a/.github/workflows/pull-db-tests.yml +++ b/.github/workflows/pull-db-tests.yml @@ -41,7 +41,7 @@ jobs: with: go-version: ">=1.20.0" - name: Add hosts to /etc/hosts - run: '[ -f "/.dockerenv" ] || echo "127.0.0.1 pgsql ldap minio" | sudo tee -a /etc/hosts' + run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 pgsql ldap minio" | sudo tee -a /etc/hosts' - run: make deps-backend - run: make backend env: @@ -119,7 +119,7 @@ jobs: with: go-version: ">=1.20.0" - name: Add hosts to /etc/hosts - run: '[ -f "/.dockerenv" ] || echo "127.0.0.1 mysql elasticsearch smtpimap" | sudo tee -a /etc/hosts' + run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 mysql elasticsearch smtpimap" | sudo tee -a /etc/hosts' - run: make deps-backend - run: make backend env: @@ -166,7 +166,7 @@ jobs: with: go-version: ">=1.20.0" - name: Add hosts to /etc/hosts - run: '[ -f "/.dockerenv" ] || echo "127.0.0.1 mysql elasticsearch smtpimap" | sudo tee -a /etc/hosts' + run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 mysql elasticsearch smtpimap" | sudo tee -a /etc/hosts' - run: make deps-backend - run: make backend env: @@ -195,7 +195,7 @@ jobs: with: go-version: ">=1.20.0" - name: Add hosts to /etc/hosts - run: '[ -f "/.dockerenv" ] || echo "127.0.0.1 mysql8" | sudo tee -a /etc/hosts' + run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 mysql8" | sudo tee -a /etc/hosts' - run: make deps-backend - run: make backend env: @@ -223,7 +223,7 @@ jobs: with: go-version: ">=1.20.0" - name: Add hosts to /etc/hosts - run: '[ -f "/.dockerenv" ] || echo "127.0.0.1 mssql" | sudo tee -a /etc/hosts' + run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 mssql" | sudo tee -a /etc/hosts' - run: make deps-backend - run: make backend env: From a75dd200db635e2e283b77b32e6fe468ff2f8d2c Mon Sep 17 00:00:00 2001 From: a1012112796 <1012112796@qq.com> Date: Thu, 18 May 2023 21:01:46 +0800 Subject: [PATCH 4/4] Update tests/integration/README.md --- tests/integration/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/README.md b/tests/integration/README.md index 0845e6726ad6e..f4e0061314668 100644 --- a/tests/integration/README.md +++ b/tests/integration/README.md @@ -31,7 +31,7 @@ Warning: This file defines many jobs, so it will be resource-intensive and there act_runner exec -W ./.github/workflows/pull-db-tests.yml --event=pull_request --default-actions-url="https://github.com" -i catthehacker/ubuntu:runner-latest -j ``` -You can can list all job names via: +You can list all job names via: ```SHELL act_runner exec -W ./.github/workflows/pull-db-tests.yml --event=pull_request --default-actions-url="https://github.com" -i catthehacker/ubuntu:runner-latest -l