Refactored integration tests
Added internal/rc to remote control a Syncthing process and made the "awaiting sync" determination reliable.
This commit is contained in:
@@ -13,7 +13,6 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/syncthing/syncthing/internal/symlinks"
|
||||
)
|
||||
@@ -27,30 +26,8 @@ func TestIgnores(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
p := syncthingProcess{ // id1
|
||||
instance: "1",
|
||||
argv: []string{"-home", "h1"},
|
||||
port: 8081,
|
||||
apiKey: apiKey,
|
||||
}
|
||||
err = p.start()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
// Wait for one scan to succeed, or up to 20 seconds... This is to let
|
||||
// startup, UPnP etc complete and make sure that we've performed folder
|
||||
// error checking which creates the folder path if it's missing.
|
||||
for i := 0; i < 20; i++ {
|
||||
err := p.rescan("default")
|
||||
if err != nil {
|
||||
time.Sleep(time.Second)
|
||||
continue
|
||||
}
|
||||
break
|
||||
}
|
||||
|
||||
defer p.stop()
|
||||
p := startInstance(t, 1)
|
||||
defer checkedStop(t, p)
|
||||
|
||||
// Create eight empty files and directories
|
||||
|
||||
@@ -85,18 +62,11 @@ func TestIgnores(t *testing.T) {
|
||||
|
||||
// Rescan and verify that we see them all
|
||||
|
||||
// Wait for one scan to succeed, or up to 20 seconds...
|
||||
// This is to let startup, UPnP etc complete.
|
||||
for i := 0; i < 20; i++ {
|
||||
err := p.rescan("default")
|
||||
if err != nil {
|
||||
time.Sleep(time.Second)
|
||||
continue
|
||||
}
|
||||
break
|
||||
if err := p.Rescan("default"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
m, err := p.model("default")
|
||||
m, err := p.Model("default")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -122,8 +92,11 @@ func TestIgnores(t *testing.T) {
|
||||
|
||||
// Rescan and verify that we see them
|
||||
|
||||
p.rescan("default")
|
||||
m, err = p.model("default")
|
||||
if err := p.Rescan("default"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
m, err = p.Model("default")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -149,8 +122,11 @@ func TestIgnores(t *testing.T) {
|
||||
|
||||
// Rescan and verify that we see them
|
||||
|
||||
p.rescan("default")
|
||||
m, err = p.model("default")
|
||||
if err := p.Rescan("default"); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
m, err = p.Model("default")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user