Skip to content

Commit 3819453

Browse files
Aligned structure, added exhaustive tests (unit), Makefile for smooth handling, singe command running, vespa search engine with strict checks on payloads, used pytests with fixtures and parametrization
1 parent 999febd commit 3819453

8 files changed

Lines changed: 311 additions & 210 deletions

File tree

rre-dataset-generator/tests/integration/docker-compose.yml

Lines changed: 0 additions & 15 deletions
This file was deleted.

rre-dataset-generator/tests/integration/vespa-init/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

rre-dataset-generator/tests/integration/vespa-init/Makefile

Lines changed: 0 additions & 24 deletions
This file was deleted.

rre-dataset-generator/tests/integration/vespa-init/dataset/dataset.json

Lines changed: 0 additions & 8 deletions
This file was deleted.

rre-dataset-generator/tests/integration/vespa-init/docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ services:
88
- "19071:19071"
99
volumes:
1010
- ./app:/app
11-
- ./dataset:/dataset
11+
- ./data:/data
1212
# Logging volume removed to avoid permission issues when host user ≠ container user
1313
healthcheck:
1414
test: ["CMD", "curl", "-sf", "http://localhost:8080/state/v1/health"]

rre-dataset-generator/tests/integration/vespa-init/test_vespa.py

Lines changed: 0 additions & 54 deletions
This file was deleted.
Lines changed: 28 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,36 @@
11
#!/usr/bin/env bash
22
set -euo pipefail
33

4-
docker exec -it vespa bash -c "vespa deploy --wait 300 ./app"
5-
# EXPECTED:
6-
# Waiting up to 5m0s for deployment to converge...
7-
docker exec -it vespa bash -c "sleep 5"
4+
# The target is the vespa container, accessible on port 8080.
5+
CONFIG_URL="http://localhost:19071"
6+
HTTP_URL="http://localhost:8080"
87

8+
# Deploy the application package
9+
echo "Deploying Vespa application (config server $CONFIG_URL)…"
10+
vespa deploy --wait 300 --target $CONFIG_URL /app
11+
sleep 5
912

10-
docker exec -it vespa bash -c "vespa feed dataset/*.json"
11-
# EXPECTED:
12-
# {
13-
# "feeder.operation.count": 1,
14-
# "feeder.seconds": 0.332,
15-
# "feeder.ok.count": 1,
16-
# "feeder.ok.rate": 1.000,
17-
# "feeder.error.count": 0,
18-
# "feeder.inflight.count": 0,
19-
# "http.request.count": 1,
20-
# "http.request.bytes": 303,
21-
# "http.request.MBps": 0.000,
22-
# "http.exception.count": 0,
23-
# "http.response.count": 1,
24-
# "http.response.bytes": 66,
25-
# "http.response.MBps": 0.000,
26-
# "http.response.error.count": 0,
27-
# "http.response.latency.millis.min": 330,
28-
# "http.response.latency.millis.avg": 330,
29-
# "http.response.latency.millis.max": 330,
30-
# "http.response.code.counts": {
31-
# "200": 1
32-
# }
33-
# }
13+
# Wait until the HTTP (query) endpoint is ready before feeding/querying
14+
echo "Waiting for Vespa HTTP endpoint on $HTTP_URL to be ready…"
15+
for i in {1..300}; do
16+
if curl -s --head "$HTTP_URL/status.html" | grep "200 OK" >/dev/null; then
17+
echo "HTTP port 8080 is up."
18+
break
19+
fi
20+
sleep 1
21+
if [ "$i" -eq 300 ]; then
22+
echo "Timeout waiting for HTTP endpoint" >&2
23+
exit 1
24+
fi
25+
done
3426

35-
docker exec -it vespa bash -c "sleep 5"
27+
# Feed the sample data
28+
echo "Feeding data …"
29+
vespa feed --target $HTTP_URL /data/*.json
30+
sleep 5
3631

32+
# Verify a simple query works
33+
echo "Running test query …"
34+
vespa query --target $HTTP_URL "select * from news where true" language=en-US
3735

38-
docker exec -it vespa bash -c "vespa query \"select * from news where true\" language=en-US"
39-
# EXPECTED:
40-
# {
41-
# "root": {
42-
# "id": "toplevel",
43-
# "relevance": 1.0,
44-
# "fields": {
45-
# "totalCount": 1
46-
# },
47-
# "coverage": {
48-
# "coverage": 100,
49-
# "documents": 1,
50-
# "full": true,
51-
# "nodes": 1,
52-
# "results": 1,
53-
# "resultsFull": 1
54-
# },
55-
# "children": [
56-
# {
57-
# "id": "id:news:news::1",
58-
# "relevance": 0.0,
59-
# "source": "news",
60-
# "fields": {
61-
# "sddocname": "news",
62-
# "documentid": "id:news:news::1",
63-
# "id": "1",
64-
# "title": "Helicopter Crashes in Colombian Drug War, Kills 20",
65-
# "description": "BOGOTA, Colombia - A U.S.-made helicopter on an anti-drugs mission crashed in the Colombian jungle on Thursday, killing all 20 Colombian soldiers aboard, the army said."
66-
# }
67-
# }
68-
# ]
69-
# }
70-
# }
36+
echo "Vespa initialization complete."

0 commit comments

Comments
 (0)