Make sure to stop processes when exiting integration test

This commit is contained in:
Jakob Borg 2014-12-30 16:04:34 +01:00
parent 1e9110b763
commit a7694029e2

View File

@ -132,11 +132,6 @@ func testSyncCluster(t *testing.T) {
t.Fatal(err)
}
p, err := scStartProcesses()
if err != nil {
t.Fatal(err)
}
// Prepare the expected state of folders after the sync
c1, err := directoryContents("s1")
if err != nil {
@ -161,6 +156,17 @@ func testSyncCluster(t *testing.T) {
}
expected := [][]fileInfo{e1, e2, e3}
// Start the syncers
p, err := scStartProcesses()
if err != nil {
t.Fatal(err)
}
defer func() {
for i := range p {
p[i].stop()
}
}()
for count := 0; count < 5; count++ {
log.Println("Forcing rescan...")
@ -242,10 +248,6 @@ func testSyncCluster(t *testing.T) {
}
expected = [][]fileInfo{e1, e2, e3}
}
for i := range p {
p[i].stop()
}
}
func scStartProcesses() ([]syncthingProcess, error) {