diff --git a/integration/h1/config.xml b/integration/h1/config.xml
index 2fc19817..cee29c1e 100644
--- a/integration/h1/config.xml
+++ b/integration/h1/config.xml
@@ -30,7 +30,7 @@
true
16
0
- 60
+ 10
5
1000
false
diff --git a/integration/h2/config.xml b/integration/h2/config.xml
index fbfc9efc..d1b79d99 100644
--- a/integration/h2/config.xml
+++ b/integration/h2/config.xml
@@ -38,7 +38,7 @@
true
16
0
- 60
+ 15
5
1000
false
diff --git a/integration/h3/config.xml b/integration/h3/config.xml
index ba506d2e..fa8d8db0 100644
--- a/integration/h3/config.xml
+++ b/integration/h3/config.xml
@@ -30,7 +30,7 @@
true
16
0
- 60
+ 20
5
1000
false
diff --git a/integration/test.sh b/integration/test.sh
index b92a56ac..1644ad47 100755
--- a/integration/test.sh
+++ b/integration/test.sh
@@ -2,7 +2,7 @@
export STNORESTART=1
-iterations=5
+iterations=${1:-5}
id1=I6KAH7666SLLL5PFXSOAUFJCDZYAOMLEKCP2GB3BV5RQST3PSROA
id2=JMFJCXBGZDE4BOCJE3VF65GYZNAIVJRET3J6HMRAUQIGJOFKNHMQ
@@ -12,12 +12,14 @@ go build genfiles.go
go build md5r.go
go build json.go
-testConvergence() {
+start() {
echo "Starting..."
for i in 1 2 3 ; do
STPROFILER=":909$i" syncthing -home "h$i" &
done
+}
+testConvergence() {
while true ; do
sleep 5
s1comp=$(curl -s "http://localhost:8082/rest/connections" | ./json "$id1/Completion")
@@ -29,8 +31,6 @@ testConvergence() {
tot=$(($s1comp + $s2comp + $s3comp))
echo $tot / 300
if [[ $tot == 300 ]] ; then
- echo "Stopping..."
- pkill syncthing
break
fi
done
@@ -72,10 +72,36 @@ testConvergence() {
fi
done
if [[ $ok != 7 ]] ; then
+ pkill syncthing
exit 1
fi
}
+alterFiles() {
+ pkill -STOP syncthing
+ for i in 1 2 3 12-1 12-2 23-2 23-3 ; do
+ pushd "s$i" >/dev/null
+
+ nfiles=$(find . -type f | wc -l)
+ if [[ $nfiles > 2000 ]] ; then
+ todelete=$(( $nfiles - 2000 ))
+ echo "Deleting $todelete files..."
+ find . -type f \
+ | sort -k 1.16 \
+ | head -n "$todelete" \
+ | xargs rm -f
+ fi
+
+ ../genfiles -maxexp 22 -files 600
+ echo " $i: append to large file"
+ dd if=/dev/urandom bs=1024k count=4 >> large-$i 2>/dev/null
+ ../md5r -l > ../md5-tmp
+ (grep -v large ../md5-tmp ; grep "large-$i" ../md5-tmp) | grep -v '/.syncthing.' > ../md5-$i
+ popd >/dev/null
+ done
+ pkill -CONT syncthing
+}
+
echo "Setting up files..."
for i in 1 2 3 12-1 12-2 23-2 23-3; do
rm -f h$i/*.idx.gz
@@ -98,21 +124,15 @@ for i in 1 2 3 12-1 12-2 23-2 23-3 ; do
popd >/dev/null
done
+start
testConvergence
-for ((t = 0; t < $iterations; t++)) ; do
- echo "Add and remove random files ($((t+1)) / $iterations)..."
- for i in 1 2 3 12-1 12-2 23-2 23-3 ; do
- pushd "s$i" >/dev/null
- rm -rf */?[02468ace]
- ../genfiles -maxexp 22 -files 600
- echo " $i: append to large file"
- dd if=/dev/urandom bs=1024k count=4 >> large-$i 2>/dev/null
- ../md5r -l > ../md5-tmp
- (grep -v large ../md5-tmp ; grep "large-$i" ../md5-tmp) > ../md5-$i
- popd >/dev/null
- done
+for ((t = 1; t <= $iterations; t++)) ; do
+ echo "Add and remove random files ($t / $iterations)..."
+ alterFiles
+ echo "Waiting..."
+ sleep 30
testConvergence
done