/ test-server-download-fix.sh
test-server-download-fix.sh
 1  #!/bin/bash
 2  
 3  echo "๐Ÿ”ง Testing KeepSync Server Download Fix"
 4  echo "======================================"
 5  
 6  # Set up test environment
 7  KEEPSYNC_DIR="/home/master/keepsync-files"
 8  BINARY_PATH="/home/master/.local/share/containers/storage/volumes/coding/_data/coding/go-lang/keepSync/keepsync"
 9  
10  cd /home/master/.local/share/containers/storage/volumes/coding/_data/coding/go-lang/keepSync
11  
12  echo "๐Ÿงน Step 1: Clear local directory to test download..."
13  rm -rf "$KEEPSYNC_DIR"/*
14  echo "โœ… Local directory cleared"
15  
16  echo ""
17  echo "๐Ÿ“Š Step 2: Verify remote files exist..."
18  aws s3 --endpoint-url=https://s3.filebase.com ls s3://storage-a01/ --recursive | grep keepsync-files
19  
20  echo ""
21  echo "๐Ÿ”„ Step 3: Start server with fixed configuration..."
22  "$BINARY_PATH" server --server-config /home/master/.keepsync/server.json > /tmp/server-download-test.log 2>&1 &
23  SERVER_PID=$!
24  
25  echo "โœ… Server started with PID: $SERVER_PID"
26  echo "๐Ÿ“‹ Waiting 5 seconds for download sync..."
27  
28  # Wait for download sync
29  sleep 5
30  
31  echo ""
32  echo "๐Ÿ“Š Step 4: Check if files were downloaded..."
33  echo "Local directory contents:"
34  ls -la "$KEEPSYNC_DIR/"
35  
36  echo ""
37  echo "๐Ÿ“„ Check downloaded file contents..."
38  for file in "$KEEPSYNC_DIR"/*.txt "$KEEPSYNC_DIR"/*.json; do
39      if [ -f "$file" ]; then
40          filename=$(basename "$file")
41          echo ""
42          echo "๐Ÿ“„ $filename:"
43          echo "   Size: $(wc -c < "$file") bytes"
44          echo "   Content: $(head -n 1 "$file")"
45      fi
46  done
47  
48  echo ""
49  echo "๐Ÿ“‹ Step 5: Check server logs..."
50  echo "Last 30 lines of server log:"
51  tail -n 30 /tmp/server-download-test.log
52  
53  echo ""
54  echo "๐Ÿ›‘ Step 6: Stop server..."
55  kill $SERVER_PID 2>/dev/null
56  wait $SERVER_PID 2>/dev/null
57  echo "โœ… Server stopped"
58  
59  echo ""
60  if [ "$(ls -A "$KEEPSYNC_DIR" 2>/dev/null)" ]; then
61      echo "โœ… SUCCESS: Files were downloaded successfully!"
62      echo "๐Ÿ” Security fix verified: Server can download securely encrypted files"
63  else
64      echo "โŒ ISSUE: No files were downloaded"
65      echo "๐Ÿ“‹ Check the log for details: /tmp/server-download-test.log"
66  fi
67  
68  echo ""
69  echo "โœ… Server download test completed!"