Fix syncing when network latency is present (#4)
* WIP * Add debug * Dedupe inserts * Add deterministic ordering * Fix whitespaces * Update insta * Add integration test script * Rename * Add test * Working for non-deletes * omg it mostly works for deletes * Isdeleted fix * remove created dates * update api * Take document id * No max attempt * works * Use string uuids * . * working!!!! (hopefully) * Improve bundling * Add module * lint * . * lint * Fix CI * use toolchain * clean up * Add useSlowFileEvents * Delete fuzz * Fix CI * use docker * fix script * clean up * Clean up * change node version * Build docker image on every commit * fix ci * 1 db per vault * Add scritps folder * Bump versions * Lint * . * Fix tests for real * Style * . * try * Consistent ordering * Fix tests * hmm * . * Clean up diff * Fixes * . * Fix version bump * . * . * .
This commit is contained in:
parent
bcf48c428d
commit
8b8f1d91d9
91 changed files with 2252 additions and 1586 deletions
79
scripts/e2e.sh
Executable file
79
scripts/e2e.sh
Executable file
|
|
@ -0,0 +1,79 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
# Check if the argument is provided
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "Usage: $0 <number_of_processes>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Get the number of processes from the first argument
|
||||
process_count=$1
|
||||
|
||||
mkdir -p logs
|
||||
|
||||
cd frontend
|
||||
npm run build
|
||||
|
||||
pids=()
|
||||
for i in $(seq 1 $process_count); do
|
||||
node test-client/dist/cli.js > "../logs/log_${i}.log" 2>&1 &
|
||||
pids+=($!)
|
||||
done
|
||||
|
||||
cd -
|
||||
|
||||
print_failed_log() {
|
||||
for i in $(seq 1 $process_count); do
|
||||
if [ -n "${pids[$i-1]}" ] && ! kill -0 ${pids[$i-1]} 2>/dev/null; then
|
||||
# Get the exit code of the process
|
||||
wait ${pids[$i-1]}
|
||||
exit_code=$?
|
||||
|
||||
# Only consider non-zero exit codes as failures
|
||||
if [ $exit_code -ne 0 ]; then
|
||||
echo "Process ${pids[$i-1]} failed with exit code $exit_code. Log file: $(pwd)/logs/log_${i}.log"
|
||||
return 0
|
||||
else
|
||||
echo "Process ${pids[$i-1]} completed successfully with exit code 0"
|
||||
# Mark this PID as processed by setting it to empty
|
||||
pids[$i-1]=""
|
||||
fi
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
echo "Monitoring $process_count processes"
|
||||
|
||||
# Monitor processes
|
||||
while true; do
|
||||
if print_failed_log; then
|
||||
# Kill remaining processes
|
||||
for pid in "${pids[@]}"; do
|
||||
if [ -n "$pid" ]; then
|
||||
kill $pid 2>/dev/null || true
|
||||
fi
|
||||
done
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if all processes have completed
|
||||
all_done=true
|
||||
for pid in "${pids[@]}"; do
|
||||
if [ -n "$pid" ] && kill -0 $pid 2>/dev/null; then
|
||||
all_done=false
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if $all_done; then
|
||||
echo "All processes completed successfully"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
sleep 0.2
|
||||
done
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue