diff options
author | Valery Piashchynski <[email protected]> | 2020-02-28 10:48:34 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2020-02-28 10:48:34 +0300 |
commit | 33f92daae1ecf9b9388cf3adb22a0efd2c3467d9 (patch) | |
tree | 1c6a84526a1e879f0d96e1bf219ab74a19d2731d /service | |
parent | b3c8c7170bb9a7d5b218faf84d7a5f17cb15404d (diff) |
Update service_tests
Diffstat (limited to 'service')
-rw-r--r-- | service/static/service_test.go | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/service/static/service_test.go b/service/static/service_test.go index 4205650d..bcda26ce 100644 --- a/service/static/service_test.go +++ b/service/static/service_test.go @@ -90,11 +90,13 @@ func Test_Files(t *testing.T) { t.Errorf("serve error: %v", err) } }() - time.Sleep(time.Millisecond * 100) - defer c.Stop() + + time.Sleep(time.Second) + b, _, _ := get("http://localhost:6029/sample.txt") assert.Equal(t, "sample", b) + c.Stop() } func Test_Disabled(t *testing.T) { @@ -334,11 +336,12 @@ func Test_Files_NotFound(t *testing.T) { t.Errorf("serve error: %v", err) } }() - time.Sleep(time.Millisecond * 100) - defer c.Stop() + + time.Sleep(time.Second) b, _, _ := get("http://localhost:6029/client.XXX?hello=world") assert.Equal(t, "WORLD", b) + c.Stop() } func Test_Files_Dir(t *testing.T) { @@ -376,11 +379,11 @@ func Test_Files_Dir(t *testing.T) { t.Errorf("serve error: %v", err) } }() - time.Sleep(time.Millisecond * 100) - defer c.Stop() + time.Sleep(time.Second) b, _, _ := get("http://localhost:6029/http?hello=world") assert.Equal(t, "WORLD", b) + c.Stop() } func Test_Files_NotForbid(t *testing.T) { @@ -418,11 +421,13 @@ func Test_Files_NotForbid(t *testing.T) { t.Errorf("serve error: %v", err) } }() - time.Sleep(time.Millisecond * 100) - defer c.Stop() + + time.Sleep(time.Second) b, _, _ := get("http://localhost:6029/client.php") assert.Equal(t, all("../../tests/client.php"), b) + assert.Equal(t, all("../../tests/client.php"), b) + c.Stop() } func tmpDir() string { |