Skip to content

Commit e9666c3

Browse files
committed
requirements for running the .sh files in localhost environments
1 parent 11d815c commit e9666c3

2 files changed

Lines changed: 16 additions & 6 deletions

File tree

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2343,9 +2343,14 @@ main() {
23432343
fi
23442344

23452345
log_info "Testing /since with full cache (cache miss - worst case)..."
2346-
local since_timestamp=$(($(date +%s) - 3600))
2347-
result=$(measure_endpoint "${API_BASE}/since/${since_timestamp}" "GET" "" "Since with full cache (miss)")
2348-
log_success "Since with full cache (cache miss)"
2346+
# Use an existing object ID from CREATED_IDS array
2347+
if [ ${#CREATED_IDS[@]} -gt 0 ]; then
2348+
local since_id=$(echo "${CREATED_IDS[0]}" | sed 's|.*/||')
2349+
result=$(measure_endpoint "${API_BASE}/since/${since_id}" "GET" "" "Since with full cache (miss)")
2350+
log_success "Since with full cache (cache miss)"
2351+
else
2352+
log_warning "Skipping since test - no created objects available"
2353+
fi
23492354

23502355
# ============================================================
23512356
# PHASE 4: Clear cache for write baseline

cache/__tests__/cache-metrics.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2339,9 +2339,14 @@ main() {
23392339
fi
23402340

23412341
log_info "Testing /since with full cache..."
2342-
local since_timestamp=$(($(date +%s) - 3600))
2343-
result=$(measure_endpoint "${API_BASE}/since/${since_timestamp}" "GET" "" "Since with full cache")
2344-
log_success "Since with full cache"
2342+
# Use an existing object ID from CREATED_IDS array
2343+
if [ ${#CREATED_IDS[@]} -gt 0 ]; then
2344+
local since_id=$(echo "${CREATED_IDS[0]}" | sed 's|.*/||')
2345+
result=$(measure_endpoint "${API_BASE}/since/${since_id}" "GET" "" "Since with full cache")
2346+
log_success "Since with full cache"
2347+
else
2348+
log_warning "Skipping since test - no created objects available"
2349+
fi
23452350

23462351
# ============================================================
23472352
# PHASE 4: Clear cache for write baseline

0 commit comments

Comments
 (0)