summaryrefslogtreecommitdiff
path: root/service/static
diff options
context:
space:
mode:
authorAnton Titov <[email protected]>2020-03-02 11:45:50 +0300
committerGitHub <[email protected]>2020-03-02 11:45:50 +0300
commitb74aedd13ef6aa0bb78bc08bb521caa36e099e9d (patch)
treebb727c3105a082ece946142fde1696ce2e895067 /service/static
parent9960aff462c985f89e1e9387e0b87bab24504d0e (diff)
parent456c9934a898fbbaf8e92e1b6bd815b6a8ffeffb (diff)
Merge pull request #260 from spiral/address_already_in_use_error
Address already in use error
Diffstat (limited to 'service/static')
-rw-r--r--service/static/service_test.go21
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 {