#!/usr/bin/env bash # Test: warmup command pre-caches files from the remote NAS # # Verifies that `warpgate warmup` reads files through the mount to pull # them into the VFS cache, so that subsequent access is local. set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" source "$SCRIPT_DIR/../harness/helpers.sh" source "$SCRIPT_DIR/../harness/mock-nas.sh" require_root setup_test_env trap teardown_test_env EXIT # Start mock NAS and create several test files start_mock_nas nas_create_file "photos/img001.jpg" 64 nas_create_file "photos/img002.jpg" 64 nas_create_file "photos/img003.jpg" 64 nas_create_file "raw/dsc001.cr3" 128 # Generate default config gen_config # Start warpgate and wait for readiness start_warpgate wait_for_mount wait_for_rc_api # Verify files are not cached yet assert_not_cached "photos/img001.jpg" assert_not_cached "photos/img002.jpg" assert_not_cached "photos/img003.jpg" assert_not_cached "raw/dsc001.cr3" # Run warmup on the root path to cache everything run_warpgate_cmd warmup "" # Verify all files are now in the VFS cache assert_cached "photos/img001.jpg" assert_cached "photos/img002.jpg" assert_cached "photos/img003.jpg" assert_cached "raw/dsc001.cr3" echo "PASS: $(basename "$0" .sh)"