Refactor and improve integration tests
This commit is contained in:
@@ -42,16 +42,11 @@ func TestIgnores(t *testing.T) {
|
||||
// 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++ {
|
||||
resp, err := p.post("/rest/scan?folder=default", nil)
|
||||
err := p.rescan("default")
|
||||
if err != nil {
|
||||
time.Sleep(time.Second)
|
||||
continue
|
||||
}
|
||||
if resp.StatusCode != 200 {
|
||||
resp.Body.Close()
|
||||
time.Sleep(time.Second)
|
||||
continue
|
||||
}
|
||||
break
|
||||
}
|
||||
|
||||
@@ -93,16 +88,11 @@ func TestIgnores(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 := p.post("/rest/scan?folder=default", nil)
|
||||
err := p.rescan("default")
|
||||
if err != nil {
|
||||
time.Sleep(time.Second)
|
||||
continue
|
||||
}
|
||||
if resp.StatusCode != 200 {
|
||||
resp.Body.Close()
|
||||
time.Sleep(time.Second)
|
||||
continue
|
||||
}
|
||||
break
|
||||
}
|
||||
|
||||
@@ -132,7 +122,7 @@ func TestIgnores(t *testing.T) {
|
||||
|
||||
// Rescan and verify that we see them
|
||||
|
||||
p.post("/rest/scan?folder=default", nil)
|
||||
p.rescan("default")
|
||||
m, err = p.model("default")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
@@ -159,7 +149,7 @@ func TestIgnores(t *testing.T) {
|
||||
|
||||
// Rescan and verify that we see them
|
||||
|
||||
p.post("/rest/scan?folder=default", nil)
|
||||
p.rescan("default")
|
||||
m, err = p.model("default")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
||||
Reference in New Issue
Block a user