Skip to content

Commit

Permalink
修复已知的代码问题
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaolaji422 committed Aug 24, 2023
1 parent b4695d0 commit 2a9ffb8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 14 additions & 0 deletions apiserver/eurekaserver/server_test.go
Expand Up @@ -18,6 +18,7 @@
package eurekaserver

import (
"net/http"
"testing"

"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -104,3 +105,16 @@ func Test_parsePeersToReplicate(t *testing.T) {
})
}
}

func TestEurekaServer_Stop(t *testing.T) {
t.Run("stop server", func(t *testing.T) {
eurekaServer := &EurekaServer{
server: &http.Server{
Addr: ":8761",
},
workers: &ApplicationsWorkers{},
}
go eurekaServer.server.ListenAndServe()
eurekaServer.Stop()
})
}
2 changes: 1 addition & 1 deletion bootstrap/server.go
Expand Up @@ -372,9 +372,9 @@ func StopServers(servers []apiserver.Apiserver) {
for _, s := range servers {
wg.Add(1)
go func(s apiserver.Apiserver, wg *sync.WaitGroup) {
defer wg.Done()
log.Infof("start stop server protocol: %s", s.GetProtocol())
s.Stop()
wg.Done()
log.Infof("complete stop server protocol: %s", s.GetProtocol())
}(s, wg)
}
Expand Down

0 comments on commit 2a9ffb8

Please sign in to comment.