Refactor and improve integration tests

This commit is contained in:
Jakob Borg
2015-04-01 10:43:19 +02:00
parent 6459d11d32
commit a3cf37cb2e
6 changed files with 134 additions and 74 deletions

View File

@@ -50,16 +50,11 @@ func TestParallellScan(t *testing.T) {
// 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++ {
resp, err := st.post("/rest/scan?folder=default", nil)
err := st.rescan("default")
if err != nil {
time.Sleep(time.Second)
continue
}
if resp.StatusCode != 200 {
resp.Body.Close()
time.Sleep(time.Second)
continue
}
break
}
@@ -73,16 +68,12 @@ func TestParallellScan(t *testing.T) {
wg.Add(1)
go func() {
defer wg.Done()
resp, err := st.post("/rest/scan?folder=default", nil)
err := st.rescan("default")
log.Println(j)
if err != nil {
log.Println(err)
t.Fatal(err)
}
if resp.StatusCode != 200 {
t.Fatalf("%d != 200", resp.StatusCode)
}
resp.Body.Close()
}()
}