From 2a87b9ffd2291e2916476182a5644187aa75caf9 Mon Sep 17 00:00:00 2001 From: perfectra1n Date: Wed, 30 Jul 2025 21:24:38 -0700 Subject: [PATCH] fix(tests): resolve issues with new config fields for user_watch in tests --- fix_all_remaining_tests.sh | 56 ++++++++++++++++++++++++++++++++++++++ fix_config_fields.sh | 27 ------------------ 2 files changed, 56 insertions(+), 27 deletions(-) create mode 100755 fix_all_remaining_tests.sh delete mode 100755 fix_config_fields.sh diff --git a/fix_all_remaining_tests.sh b/fix_all_remaining_tests.sh new file mode 100755 index 0000000..9f418e5 --- /dev/null +++ b/fix_all_remaining_tests.sh @@ -0,0 +1,56 @@ +#\!/bin/bash + +# Files with missing Config fields +config_files=( +"tests/integration_smart_sync_targeted_scan.rs" +"tests/integration_s3_sync_tests.rs" +"tests/unit_webdav_edge_cases_tests.rs" +"tests/unit_webdav_url_management_tests.rs" +"tests/integration_webdav_concurrency_tests.rs" +"tests/integration_smart_sync_error_handling.rs" +"tests/integration_webdav_sync_tests.rs" +"tests/unit_webdav_directory_tracking_tests.rs" +"tests/unit_basic_sync_tests.rs" +"tests/unit_webdav_unit_tests.rs" +"tests/integration_webdav_smart_scanning_tests.rs" +"tests/unit_webdav_enhanced_unit_tests.rs" +"tests/integration_webdav_scheduler_concurrency_tests.rs" +"tests/integration_smart_sync_deep_scan.rs" +"tests/integration_smart_sync_no_changes.rs" +"tests/integration_local_folder_sync_tests.rs" +"tests/webdav_production_flow_integration_tests.rs" +"tests/integration_webdav_first_time_scan_tests.rs" +"tests/unit_webdav_targeted_rescan_tests.rs" +"tests/integration_smart_sync_first_time.rs" +"tests/unit_smart_sync_service_tests.rs" +"tests/unit_webdav_smart_scan_logic_tests.rs" +) + +echo "Fixing Config structs in ${#config_files[@]} files..." + +for file in "${config_files[@]}"; do + if [ -f "$file" ]; then + echo "Processing $file..." + # Check if file has Config struct and missing fields + if grep -q "Config {" "$file" && \! grep -q "user_watch_base_dir" "$file"; then + # Add the missing fields after watch_folder line + sed -i.bak '/watch_folder:/a\ + user_watch_base_dir: "./user_watch".to_string(),\ + enable_per_user_watch: false,' "$file" + + # Clean up formatting + sed -i 's/enable_per_user_watch: false, /enable_per_user_watch: false,\n /' "$file" + sed -i 's/enable_per_user_watch: false, /enable_per_user_watch: false,\n /' "$file" + + # Remove backup + rm "${file}.bak" 2>/dev/null || true + echo "Fixed Config in $file" + else + echo "Skipping $file (no Config struct or already fixed)" + fi + else + echo "File not found: $file" + fi +done + +echo "Config fixes completed." diff --git a/fix_config_fields.sh b/fix_config_fields.sh deleted file mode 100755 index 9658c67..0000000 --- a/fix_config_fields.sh +++ /dev/null @@ -1,27 +0,0 @@ -#\!/bin/bash - -# List of test files that need Config struct fixes -files=( -"tests/integration_config_oidc_tests.rs" -"tests/integration_source_sync_cancellation_workflow_tests.rs" -"tests/integration_source_scheduler_tests.rs" -"tests/integration_webdav_hash_duplicate_tests.rs" -"tests/integration_stop_sync_functionality_tests.rs" -"tests/integration_universal_source_sync_tests.rs" -) - -for file in "${files[@]}"; do - if [ -f "$file" ]; then - echo "Fixing $file..." - # Use sed to add the missing fields after watch_folder line - sed -i.bak '/watch_folder: /a\ - user_watch_base_dir: "./user_watch".to_string(),\ - enable_per_user_watch: false,' "$file" - - # Remove backup file - rm "${file}.bak" 2>/dev/null || true - echo "Fixed $file" - else - echo "File not found: $file" - fi -done