🌐 AI搜索 & 代理 主页
Skip to content

Commit f862b19

Browse files
Updated test commands to be accurate to CLI
1 parent 43e24d9 commit f862b19

File tree

2 files changed

+29
-28
lines changed

2 files changed

+29
-28
lines changed

.gitlab-ci.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ cli:node:smoke:
7070
- node -v && npm -v
7171
- npm --prefix cli install --no-audit --no-fund
7272
- node ./cli/dist/bin/postgres-ai.js --help
73-
- node ./cli/dist/bin/postgres-ai.js status --help
74-
- node ./cli/dist/bin/postgres-ai.js list-instances --help
73+
- node ./cli/dist/bin/postgres-ai.js mon status --help
74+
- node ./cli/dist/bin/postgres-ai.js mon targets list --help
7575
- npm install -g ./cli
7676
- echo "prefix=$(npm config get prefix)" && echo "PATH=$PATH"
7777
- command -v postgres-ai && postgres-ai --help
@@ -83,9 +83,9 @@ cli:node:smoke:
8383
- grep -q 'test_key' ~/.config/postgresai/config.json
8484
- node ./cli/dist/bin/postgres-ai.js remove-key
8585
- if grep -q 'apiKey' ~/.config/postgresai/config.json; then echo 'key not removed' && exit 1; fi
86-
- node ./cli/dist/bin/postgres-ai.js list-instances | head -n 1 || true
87-
- node ./cli/dist/bin/postgres-ai.js add-instance 'postgresql://user:pass@host:5432/db' ci-test || true
88-
- node ./cli/dist/bin/postgres-ai.js remove-instance ci-test || true
86+
- node ./cli/dist/bin/postgres-ai.js mon targets list | head -n 1 || true
87+
- node ./cli/dist/bin/postgres-ai.js mon targets add 'postgresql://user:pass@host:5432/db' ci-test || true
88+
- node ./cli/dist/bin/postgres-ai.js mon targets remove ci-test || true
8989
rules:
9090
- if: '$CI_COMMIT_BRANCH'
9191

@@ -142,9 +142,9 @@ cli:node:full:dind:
142142
- echo "SELECT 1;" | node ./cli/dist/bin/postgres-ai.js mon shell target-db || true
143143
- echo ""
144144
- echo "=== Testing complete workflow ==="
145-
- node ./cli/dist/bin/postgres-ai.js mon add-instance "postgresql://monitor:monitor_pass@target-db:5432/target_database" demo-test
146-
- node ./cli/dist/bin/postgres-ai.js mon list-instances
147-
- node ./cli/dist/bin/postgres-ai.js mon test-instance demo-test || true
145+
- node ./cli/dist/bin/postgres-ai.js mon targets add "postgresql://monitor:monitor_pass@target-db:5432/target_database" demo-test
146+
- node ./cli/dist/bin/postgres-ai.js mon targets list
147+
- node ./cli/dist/bin/postgres-ai.js mon targets test demo-test || true
148148
- node ./cli/dist/bin/postgres-ai.js mon health --wait 120
149149
- node ./cli/dist/bin/postgres-ai.js mon show-grafana-credentials
150150
- echo ""

tests/e2e.cli.sh

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,27 @@
44

55
set -e
66

7-
CLI_CMD="node ./cli/dist/bin/postgres-ai.js mon"
7+
CLI_CMD="node ./cli/dist/bin/postgres-ai.js"
8+
MON_CMD="$CLI_CMD mon"
89

910
echo "=== Testing service commands ==="
10-
$CLI_CMD check || true
11-
$CLI_CMD config || true
12-
$CLI_CMD update-config
13-
$CLI_CMD start
11+
$MON_CMD check || true
12+
$MON_CMD config || true
13+
$MON_CMD update-config
14+
$MON_CMD start
1415
sleep 10
15-
$CLI_CMD status
16-
$CLI_CMD logs --tail 5 grafana || true
17-
$CLI_CMD health --wait 60 || true
16+
$MON_CMD status
17+
$MON_CMD logs --tail 5 grafana || true
18+
$MON_CMD health --wait 60 || true
1819

1920
echo ""
2021
echo "=== Testing instance commands ==="
21-
$CLI_CMD list-instances
22-
$CLI_CMD add-instance "postgresql://monitor:monitor_pass@target-db:5432/target_database" ci-test
23-
$CLI_CMD list-instances | grep -q ci-test
22+
$MON_CMD targets list
23+
$MON_CMD targets add "postgresql://monitor:monitor_pass@target-db:5432/target_database" ci-test
24+
$MON_CMD targets list | grep -q ci-test
2425
sleep 5
25-
$CLI_CMD test-instance ci-test || true
26-
$CLI_CMD remove-instance ci-test
26+
$MON_CMD targets test ci-test || true
27+
$MON_CMD targets remove ci-test
2728

2829
echo ""
2930
echo "=== Testing API key commands ==="
@@ -33,17 +34,17 @@ $CLI_CMD remove-key
3334

3435
echo ""
3536
echo "=== Testing Grafana commands ==="
36-
$CLI_CMD show-grafana-credentials || true
37-
$CLI_CMD generate-grafana-password || true
38-
$CLI_CMD show-grafana-credentials || true
37+
$MON_CMD show-grafana-credentials || true
38+
$MON_CMD generate-grafana-password || true
39+
$MON_CMD show-grafana-credentials || true
3940

4041
echo ""
4142
echo "=== Testing service management ==="
42-
$CLI_CMD restart grafana
43+
$MON_CMD restart grafana
4344
sleep 3
44-
$CLI_CMD status
45-
$CLI_CMD stop
46-
$CLI_CMD clean || true
45+
$MON_CMD status
46+
$MON_CMD stop
47+
$MON_CMD clean || true
4748

4849
echo ""
4950
echo "✓ All E2E tests passed"

0 commit comments

Comments
 (0)