diff options
author | Valery Piashchynski <[email protected]> | 2020-03-02 12:57:59 +0300 |
---|---|---|
committer | GitHub <[email protected]> | 2020-03-02 12:57:59 +0300 |
commit | 9fabf648f1c3cb797ec03377c3e2182397fb7a1a (patch) | |
tree | 24160fac1b10db90149f66abd0d814e5cd91bf53 | |
parent | 52cc4890dddce5dd299eda50b4d0f5ce7a3de989 (diff) | |
parent | 876b2fe2ac446912b374de781dc1852c7b4cc053 (diff) |
Merge pull request #263 from spiral/rotate_ports_in_static
Fix for failing tests
-rw-r--r-- | service/static/service_test.go | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/service/static/service_test.go b/service/static/service_test.go index 0480e14d..bd929214 100644 --- a/service/static/service_test.go +++ b/service/static/service_test.go @@ -150,11 +150,15 @@ func Test_Files_Disable(t *testing.T) { t.Errorf("serve error: %v", err) } }() - time.Sleep(time.Millisecond * 100) - defer c.Stop() - b, _, _ := get("http://localhost:8030/client.php?hello=world") + time.Sleep(time.Second) + + b, _, err := get("http://localhost:8030/client.php?hello=world") + if err != nil { + t.Fatal(err) + } assert.Equal(t, "WORLD", b) + c.Stop() } func Test_Files_Error(t *testing.T) { @@ -252,11 +256,14 @@ func Test_Files_Forbid(t *testing.T) { t.Errorf("serve error: %v", err) } }() - time.Sleep(time.Millisecond * 100) - defer c.Stop() + time.Sleep(time.Millisecond * 500) - b, _, _ := get("http://localhost:8033/client.php?hello=world") + b, _, err := get("http://localhost:8033/client.php?hello=world") + if err != nil { + t.Fatal(err) + } assert.Equal(t, "WORLD", b) + c.Stop() } func Test_Files_Always(t *testing.T) { @@ -294,11 +301,15 @@ func Test_Files_Always(t *testing.T) { t.Errorf("serve error: %v", err) } }() - time.Sleep(time.Millisecond * 100) - defer c.Stop() - _, r, _ := get("http://localhost:8034/favicon.ico") + time.Sleep(time.Millisecond * 500) + + _, r, err := get("http://localhost:8034/favicon.ico") + if err != nil { + t.Fatal(err) + } assert.Equal(t, 404, r.StatusCode) + c.Stop() } func Test_Files_NotFound(t *testing.T) { @@ -337,7 +348,7 @@ func Test_Files_NotFound(t *testing.T) { } }() - time.Sleep(time.Second) + time.Sleep(time.Millisecond * 500) b, _, _ := get("http://localhost:8035/client.XXX?hello=world") assert.Equal(t, "WORLD", b) @@ -379,7 +390,7 @@ func Test_Files_Dir(t *testing.T) { t.Errorf("serve error: %v", err) } }() - time.Sleep(time.Second) + time.Sleep(time.Millisecond * 500) b, _, _ := get("http://localhost:8036/http?hello=world") assert.Equal(t, "WORLD", b) @@ -422,7 +433,7 @@ func Test_Files_NotForbid(t *testing.T) { } }() - time.Sleep(time.Second) + time.Sleep(time.Millisecond * 500) b, _, _ := get("http://localhost:8037/client.php") assert.Equal(t, all("../../tests/client.php"), b) |