From 29fde14445b075809c62277f57bcce1b6edbcde2 Mon Sep 17 00:00:00 2001 From: niko Date: Wed, 17 Jun 2026 07:41:01 +0300 Subject: [PATCH] Fix/fragile test (#19) Co-authored-by: moilanik Reviewed-on: https://gitea.app.keskikuja.site/niko/gitea-ci-library/pulls/19 --- .gitignore | 1 + tests/features/step_definitions/common.steps.js | 2 +- tests/helpers/mock-api.sh | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index ab0d526..aa183b1 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ tmp/ coverage/ .DS_Store reports/ +.vscode/ diff --git a/tests/features/step_definitions/common.steps.js b/tests/features/step_definitions/common.steps.js index 5695fef..6c665a8 100644 --- a/tests/features/step_definitions/common.steps.js +++ b/tests/features/step_definitions/common.steps.js @@ -6,7 +6,7 @@ const PROJECT_ROOT = path.resolve(__dirname, '..', '..', '..'); const MOCK_SCRIPT = path.join(PROJECT_ROOT, 'tests', 'helpers', 'mock-api.sh'); Before({ tags: '@mock' }, function () { - const out = execSync(`bash -c 'source "${MOCK_SCRIPT}" && mock_start && sleep 0.3 && curl -s -o /dev/null -w "%{http_code}" --max-time 3 http://localhost:18080/api/v1/repos/health/check'`, { + const out = execSync(`bash -c 'source "${MOCK_SCRIPT}" && mock_start && sleep 1 && curl -s -o /dev/null -w "%{http_code}" --max-time 3 http://localhost:18080/api/v1/repos/health/check'`, { cwd: PROJECT_ROOT, encoding: 'utf-8', stdio: ['pipe', 'pipe', 'pipe'], diff --git a/tests/helpers/mock-api.sh b/tests/helpers/mock-api.sh index 1bdc292..0fa965b 100644 --- a/tests/helpers/mock-api.sh +++ b/tests/helpers/mock-api.sh @@ -55,7 +55,7 @@ mock_start() { nohup python3 "$(dirname "${BASH_SOURCE[0]}")/mock-server.py" "$MOCK_PORT" "$MOCK_CONFIG_FILE" "$MOCK_REQUEST_FILE" \ /dev/null 2>&1 & MOCK_PID=$! - sleep 0.5 + sleep 1 } mock_stop() {