I'm- 👋 Hi, I’m @LeojMarco
- 👀 I’m interested in ...
- 🌱 I’m currently learning ...
- 💞️ I’m looking to collaborate on ...
- 📫 How to reach me ...
- 😄 Pronouns: ...
- ⚡ Fun fact: ...
#!/bin/bash
if [[ $UNDER_TEST_RUNNER -ne 1 ]]; then echo "This script should be run under run_integration_tests.sh" exit 1 fi
set -euo pipefail
log() { echo "[$(date)] $1"; }
log "Running Bazel test..." bazel --output_base="$BAZEL_CACHE_DIR" test --config self_test //:dummy_test
log "Fetching metrics..." all_contents="$(curl --retry 5 --retry-delay 0 --retry-max-time 30 http://127.0.0.1:50061/metrics 2>&1)" || { log "Failed to fetch metrics: $all_contents" exit 1 }
echo "$all_contents"
#!/bin/bash
if [[ $UNDER_TEST_RUNNER -ne 1 ]]; then echo "This script should be run under run_integration_tests.sh" exit 1 fi
set -euo pipefail
log() { echo "[$(date)] $1"; }
run_bazel_test() { log "Running Bazel test..." bazel --output_base="$BAZEL_CACHE_DIR" test --config self_test //:dummy_test }
fetch_metrics() { log "Fetching metrics..." local metrics_url="http://127.0.0.1:50061/metrics" all_contents="$(curl --retry 5 --retry-delay 0 --retry-max-time 30 "$metrics_url" 2>&1)" || { log "Failed to fetch metrics from $metrics_url: $all_contents" exit 1 } echo "$all_contents" }
check_metric() { local metric_name=$1 local expected_value=$2
log "Checking metric: $metric_name = $expected_value" if ! grep -q "$metric_name $expected_value" <<< "$all_contents"; then log "ERROR: Expected metric '$metric_name' to be '$expected_value' but not found in metrics." exit 1 fi }
run_bazel_test all_contents=$(fetch_metrics)
echo "$all_contents"
check_metric 'nativelink_stores_AC_MAIN_STORE_evicting_map_max_bytes' 500000000 check_metric 'nativelink_stores_AC_MAIN_STORE_read_buff_size_bytes' 32768
count=$(grep -c 'nativelink_stores_AC_MAIN_STORE_evicting_map_max_bytes 500000000' <<< "$all_contents") if [[ $count -ne 1 ]]; then log "ERROR: Expected 1 instance of CAS_MAIN_STORE, but found $count" exit 1 fi
check_metric 'nativelink_stores_AC_MAIN_STORE_evicting_map_item_size_bytes{quantile="0.99"}' '[0-9]+(.[0-9]+)?' # Check for a numeric value check_metric 'nativelink_stores_AC_MAIN_STORE_evicting_map_items_in_store_total' 3
log "All metric checks passed successfully."