Skip to content

Commit 820bbe9

Browse files
committed
Fix integration tests listen address regression
1 parent f1ddb98 commit 820bbe9

File tree

6 files changed

+92
-32
lines changed

6 files changed

+92
-32
lines changed

.github/workflows/ci.yml

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,33 @@ jobs:
199199
200200
- name: Run all tests with coverage and JUnit report
201201
run: npm run test:coverage -- --reporter=junit --outputFile=test-report.junit.xml
202+
203+
- name: Check test results and show failures
204+
if: always()
205+
run: |
206+
# Check if tests actually failed (JUnit report will show failure details)
207+
if [ -f test-report.junit.xml ]; then
208+
# Get the total failures and errors from the root testsuites element
209+
failures=$(grep -o '<testsuites[^>]*failures="[0-9]*"' test-report.junit.xml | grep -o 'failures="[0-9]*"' | cut -d'"' -f2)
210+
errors=$(grep -o '<testsuites[^>]*errors="[0-9]*"' test-report.junit.xml | grep -o 'errors="[0-9]*"' | cut -d'"' -f2)
211+
212+
if [ "$failures" != "0" ] || [ "$errors" != "0" ]; then
213+
echo "❌ Tests failed: $failures failures, $errors errors"
214+
echo ""
215+
echo "=== Failure Details ==="
216+
# Show specific failure messages
217+
grep -A 3 "<failure" test-report.junit.xml || echo "No detailed failure info found"
218+
echo ""
219+
else
220+
echo "✅ All tests passed successfully"
221+
fi
222+
else
223+
echo "⚠️ No test report found"
224+
fi
202225
timeout-minutes: 10
203226
env:
204-
QDRANT_ENDPOINT: http://localhost:6333
205-
OLLAMA_ENDPOINT: http://localhost:11434
227+
QDRANT_ENDPOINT: http://127.0.0.1:6333
228+
OLLAMA_ENDPOINT: http://127.0.0.1:11434
206229
DIRECTORY_INDEXER_QDRANT_COLLECTION: directory-indexer-test
207230

208231
- name: Upload coverage to Codecov

.github/workflows/release.yml

Lines changed: 50 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,6 @@ jobs:
3434
runs-on: ubuntu-latest
3535
needs: validate-version
3636

37-
services:
38-
qdrant:
39-
image: qdrant/qdrant:v1.11.0
40-
ports:
41-
- 6333:6333
42-
43-
ollama:
44-
image: ollama/ollama:0.3.12
45-
ports:
46-
- 11434:11434
47-
env:
48-
OLLAMA_HOST: 0.0.0.0
49-
5037
steps:
5138
- uses: actions/checkout@v4
5239

@@ -56,6 +43,16 @@ jobs:
5643
node-version: "18"
5744
cache: "npm"
5845

46+
- name: Cache Docker images and Ollama models
47+
uses: actions/cache@v4
48+
with:
49+
path: |
50+
/tmp/docker-cache
51+
/tmp/ollama-models
52+
key: integration-cache-${{ hashFiles('.github/workflows/release.yml') }}-v2
53+
restore-keys: |
54+
integration-cache-
55+
5956
- name: Install dependencies
6057
run: npm ci
6158

@@ -68,8 +65,31 @@ jobs:
6865
- name: Build
6966
run: npm run build
7067

71-
- name: Wait for services
68+
- name: Setup services for integration tests
7269
run: |
70+
# Create directories for caching
71+
mkdir -p /tmp/docker-cache /tmp/ollama-models
72+
73+
# Pull Docker images (will use Docker's built-in layer cache)
74+
echo "Pulling Docker images..."
75+
docker pull qdrant/qdrant:v1.11.0 &
76+
docker pull ollama/ollama:0.3.12 &
77+
wait
78+
echo "✅ Docker images ready"
79+
80+
# Start Qdrant container
81+
echo "Starting Qdrant..."
82+
docker run -d --name qdrant -p 6333:6333 qdrant/qdrant:v1.11.0
83+
84+
# Start Ollama with model volume mounted
85+
echo "Starting Ollama..."
86+
docker run -d --name ollama \
87+
-p 11434:11434 \
88+
-v /tmp/ollama-models:/root/.ollama \
89+
-e OLLAMA_HOST=0.0.0.0 \
90+
ollama/ollama:0.3.12
91+
92+
# Wait for services
7393
echo "Waiting for Qdrant..."
7494
timeout 120 bash -c 'until curl -f http://localhost:6333/healthz; do echo " Qdrant not ready, waiting..."; sleep 2; done'
7595
echo "✅ Qdrant is ready!"
@@ -78,14 +98,26 @@ jobs:
7898
timeout 180 bash -c 'until curl -f http://localhost:11434/api/tags; do echo " Ollama not ready, waiting..."; sleep 5; done'
7999
echo "✅ Ollama is ready!"
80100
81-
echo "Pulling nomic-embed-text model..."
82-
curl -X POST http://localhost:11434/api/pull -d '{"name":"nomic-embed-text"}' --max-time 300
101+
# Check if model is already cached
102+
if [ -f "/tmp/ollama-models/models/manifests/registry.ollama.ai/library/nomic-embed-text/latest" ]; then
103+
echo "✅ nomic-embed-text model found in cache"
104+
else
105+
echo "Pulling nomic-embed-text model..."
106+
curl -X POST http://localhost:11434/api/pull -d '{"name":"nomic-embed-text"}' --max-time 300
107+
echo "✅ Model pull completed"
108+
fi
83109
84110
- name: Run all tests
85111
run: npm test
86112
env:
87-
QDRANT_ENDPOINT: http://localhost:6333
88-
OLLAMA_ENDPOINT: http://localhost:11434
113+
QDRANT_ENDPOINT: http://127.0.0.1:6333
114+
OLLAMA_ENDPOINT: http://127.0.0.1:11434
115+
116+
- name: Cleanup containers
117+
if: always()
118+
run: |
119+
docker stop qdrant ollama || true
120+
docker rm qdrant ollama || true
89121
90122
create-release:
91123
name: Create GitHub Release

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,6 @@ test-output/
6060
# Coverage
6161
coverage/
6262
lcov.info
63-
*.profraw
63+
*.profraw
64+
65+
test-report.junit.xml

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "directory-indexer",
3-
"version": "0.0.16",
3+
"version": "0.0.19",
44
"description": "AI-powered directory indexing with semantic search for MCP servers",
55
"main": "dist/cli.js",
66
"bin": {

tests/cli.unit.test.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ describe('CLI Unit Tests', () => {
3434

3535
try {
3636
await main();
37-
} catch {
38-
// Expected to exit with error
37+
} catch (error) {
38+
console.log('Expected error for search without query:', error instanceof Error ? error.message : String(error));
3939
}
4040

4141
expect(exitCode).toBe(1);
@@ -46,8 +46,8 @@ describe('CLI Unit Tests', () => {
4646

4747
try {
4848
await main();
49-
} catch {
50-
// Expected to exit with error
49+
} catch (error) {
50+
console.log('Expected error for similar without file:', error instanceof Error ? error.message : String(error));
5151
}
5252

5353
expect(exitCode).toBe(1);
@@ -58,8 +58,8 @@ describe('CLI Unit Tests', () => {
5858

5959
try {
6060
await main();
61-
} catch {
62-
// Expected to exit with error
61+
} catch (error) {
62+
console.log('Expected error for get without file:', error instanceof Error ? error.message : String(error));
6363
}
6464

6565
expect(exitCode).toBe(1);
@@ -70,8 +70,8 @@ describe('CLI Unit Tests', () => {
7070

7171
try {
7272
await main();
73-
} catch {
74-
// Expected to exit with error
73+
} catch (error) {
74+
console.log('Expected error for index without paths:', error instanceof Error ? error.message : String(error));
7575
}
7676

7777
expect(exitCode).toBe(1);
@@ -100,8 +100,8 @@ describe('CLI Unit Tests', () => {
100100

101101
try {
102102
await main();
103-
} catch {
104-
// Expected to exit with error
103+
} catch (error) {
104+
console.log('Expected error for invalid command:', error instanceof Error ? error.message : String(error));
105105
}
106106

107107
expect(exitCode).toBe(1);

vite.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ export default defineConfig({
5959
singleThread: false,
6060
},
6161
},
62+
outputFile: {
63+
junit: './test-report.junit.xml'
64+
},
6265
coverage: {
6366
provider: 'v8',
6467
reporter: ['text', 'html', 'json', 'lcov'],

0 commit comments

Comments
 (0)