Skip to content

Commit f75d04e

Browse files
committed
changes from testing scripts in local environment
1 parent 777f9aa commit f75d04e

2 files changed

Lines changed: 12 additions & 12 deletions

File tree

cache/__tests__/cache-metrics-worst-case.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ test_search_endpoint() {
382382

383383
# Test search functionality
384384
log_info "Testing search with cold cache..."
385-
local result=$(measure_endpoint "${API_BASE}/api/search" "POST" '{"query":"annotation","limit":5}' "Search for 'annotation'")
385+
local result=$(measure_endpoint "${API_BASE}/api/search" "POST" '{"searchText":"annotation","limit":5}' "Search for 'annotation'")
386386
local cold_time=$(echo "$result" | cut -d'|' -f1)
387387
local cold_code=$(echo "$result" | cut -d'|' -f2)
388388

@@ -1364,7 +1364,7 @@ test_search_phrase_endpoint() {
13641364

13651365
# Test search phrase functionality
13661366
log_info "Testing search phrase with cold cache..."
1367-
local result=$(measure_endpoint "${API_BASE}/api/search/phrase" "POST" '{"query":"test phrase","limit":5}' "Phrase search")
1367+
local result=$(measure_endpoint "${API_BASE}/api/search/phrase" "POST" '{"searchText":"test phrase","limit":5}' "Phrase search")
13681368
local cold_time=$(echo "$result" | cut -d'|' -f1)
13691369
local cold_code=$(echo "$result" | cut -d'|' -f2)
13701370

@@ -2283,11 +2283,11 @@ main() {
22832283
log_success "Query with full cache (cache miss)"
22842284

22852285
log_info "Testing /api/search with full cache (cache miss - worst case)..."
2286-
result=$(measure_endpoint "${API_BASE}/api/search" "POST" '{"query":"xyzNonExistentQuery999","limit":5}' "Search with full cache (miss)")
2286+
result=$(measure_endpoint "${API_BASE}/api/search" "POST" '{"searchText":"xyzNonExistentQuery999","limit":5}' "Search with full cache (miss)")
22872287
log_success "Search with full cache (cache miss)"
22882288

22892289
log_info "Testing /api/search/phrase with full cache (cache miss - worst case)..."
2290-
result=$(measure_endpoint "${API_BASE}/api/search/phrase" "POST" '{"query":"xyzNonExistent phrase999","limit":5}' "Search phrase with full cache (miss)")
2290+
result=$(measure_endpoint "${API_BASE}/api/search/phrase" "POST" '{"searchText":"xyzNonExistent phrase999","limit":5}' "Search phrase with full cache (miss)")
22912291
log_success "Search phrase with full cache (cache miss)"
22922292

22932293
# For ID, history, since - use objects created in Phase 1 (these will cause cache misses too)

cache/__tests__/cache-metrics.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -238,11 +238,11 @@ fill_cache() {
238238
elif [ $pattern -eq 1 ]; then
239239
curl -s -X POST "${API_BASE}/api/search" \
240240
-H "Content-Type: application/json" \
241-
-d "{\"query\":\"annotation\"}" > /dev/null 2>&1
241+
-d "{\"searchText\":\"annotation\"}" > /dev/null 2>&1
242242
else
243243
curl -s -X POST "${API_BASE}/api/search/phrase" \
244244
-H "Content-Type: application/json" \
245-
-d "{\"query\":\"test annotation\"}" > /dev/null 2>&1
245+
-d "{\"searchText\":\"test annotation\"}" > /dev/null 2>&1
246246
fi
247247
else
248248
# Add diversity to fill cache with different entries
@@ -253,11 +253,11 @@ fill_cache() {
253253
elif [ $pattern -eq 1 ]; then
254254
curl -s -X POST "${API_BASE}/api/search" \
255255
-H "Content-Type: application/json" \
256-
-d "{\"query\":\"annotation\",\"skip\":$count}" > /dev/null 2>&1
256+
-d "{\"searchText\":\"annotation\",\"skip\":$count}" > /dev/null 2>&1
257257
else
258258
curl -s -X POST "${API_BASE}/api/search/phrase" \
259259
-H "Content-Type: application/json" \
260-
-d "{\"query\":\"test annotation\",\"skip\":$count}" > /dev/null 2>&1
260+
-d "{\"searchText\":\"test annotation\",\"skip\":$count}" > /dev/null 2>&1
261261
fi
262262
fi
263263
) &
@@ -401,7 +401,7 @@ test_search_endpoint() {
401401

402402
# Test search functionality
403403
log_info "Testing search with cold cache..."
404-
local result=$(measure_endpoint "${API_BASE}/api/search" "POST" '{"query":"annotation","limit":5}' "Search for 'annotation'")
404+
local result=$(measure_endpoint "${API_BASE}/api/search" "POST" '{"searchText":"annotation","limit":5}' "Search for 'annotation'")
405405
local cold_time=$(echo "$result" | cut -d'|' -f1)
406406
local cold_code=$(echo "$result" | cut -d'|' -f2)
407407

@@ -1383,7 +1383,7 @@ test_search_phrase_endpoint() {
13831383

13841384
# Test search phrase functionality
13851385
log_info "Testing search phrase with cold cache..."
1386-
local result=$(measure_endpoint "${API_BASE}/api/search/phrase" "POST" '{"query":"test phrase","limit":5}' "Phrase search")
1386+
local result=$(measure_endpoint "${API_BASE}/api/search/phrase" "POST" '{"searchText":"test phrase","limit":5}' "Phrase search")
13871387
local cold_time=$(echo "$result" | cut -d'|' -f1)
13881388
local cold_code=$(echo "$result" | cut -d'|' -f2)
13891389

@@ -2279,11 +2279,11 @@ main() {
22792279
log_success "Query with full cache"
22802280

22812281
log_info "Testing /api/search with full cache..."
2282-
result=$(measure_endpoint "${API_BASE}/api/search" "POST" '{"query":"annotation"}' "Search with full cache")
2282+
result=$(measure_endpoint "${API_BASE}/api/search" "POST" '{"searchText":"annotation"}' "Search with full cache")
22832283
log_success "Search with full cache"
22842284

22852285
log_info "Testing /api/search/phrase with full cache..."
2286-
result=$(measure_endpoint "${API_BASE}/api/search/phrase" "POST" '{"query":"test annotation"}' "Search phrase with full cache")
2286+
result=$(measure_endpoint "${API_BASE}/api/search/phrase" "POST" '{"searchText":"test annotation"}' "Search phrase with full cache")
22872287
log_success "Search phrase with full cache"
22882288

22892289
# For ID, history, since - use objects created in Phase 1 if available

0 commit comments

Comments
 (0)