]> 127.0.0.1 Git - part/.git/commitdiff
add
authorqydysky <qydysky@foxmail.com>
Thu, 25 May 2023 17:48:16 +0000 (01:48 +0800)
committerqydysky <qydysky@foxmail.com>
Thu, 25 May 2023 17:48:16 +0000 (01:48 +0800)
web/Web_test.go

index a42b464176e577a8e84573996f33dbb04215ee13..a3d4bb3fca5dcc1735ac4fb31661c1be5249dd0f 100644 (file)
@@ -87,9 +87,10 @@ func Test_ServerSyncMapP(t *testing.T) {
                A string `json:"path"`
        }
 
-       NewSyncMap(&http.Server{
+       o := NewSyncMap(&http.Server{
                Addr: "127.0.0.1:9090",
        }, &m)
+       defer o.Shutdown()
        m.Store("/1/2", func(w http.ResponseWriter, _ *http.Request) {
                ResStruct{0, "ok", d{"/1/2"}}.Write(w)
        })
@@ -102,6 +103,7 @@ func Test_ServerSyncMapP(t *testing.T) {
        m.Store("/", func(w http.ResponseWriter, _ *http.Request) {
                ResStruct{0, "ok", d{"/"}}.Write(w)
        })
+       time.Sleep(time.Second)
 
        r := reqf.New()
        res := ResStruct{}