Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
client: do cleanup after UT stop mock server
Browse files Browse the repository at this point in the history
Signed-off-by: NingBo <[email protected]>
  • Loading branch information
NingBo committed Nov 29, 2018
1 parent 0ff3006 commit e614630
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion protocols/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ const (
)

func startMockServer(t *testing.T, enableYamux bool) (*grpc.Server, chan error, error) {
os.Remove(mockSockAddr)
err := os.RemoveAll(mockSockAddr)
assert.Nil(t, err, "Remove %s failed", mockSockAddr)
if err != nil {
assert.FailNow(t, err.Error(), "Failed to start mock server")
}

l, err := net.Listen("unix", mockSockAddr)
assert.Nil(t, err, "Listen on %s failed: %s", mockSockAddr, err)
Expand Down Expand Up @@ -132,6 +136,7 @@ func TestNewAgentClient(t *testing.T) {
// wait mock server to stop
mock.Stop()
<-waitCh
os.Remove(mockSockAddr)
}

func TestNewAgentClientWithYamux(t *testing.T) {
Expand All @@ -153,4 +158,5 @@ func TestNewAgentClientWithYamux(t *testing.T) {
// wait mock server to stop
mock.Stop()
<-waitCh
os.Remove(mockSockAddr)
}

0 comments on commit e614630

Please sign in to comment.