Skip to content

Commit

Permalink
Extend fakeServer to stop the Marathon client by default.
Browse files Browse the repository at this point in the history
Add extra CloseServer method for cases where only the server should be
closed.
  • Loading branch information
timoreimann committed Aug 28, 2017
1 parent a2fb56c commit 0fd6fa5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions subscription_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ func TestConnectToSSEFailure(t *testing.T) {
config := configContainer{client: &clientCfg}

endpoint := newFakeMarathonEndpoint(t, &config)
endpoint.Close()
endpoint.CloseServer()

client := endpoint.Client.(*marathonClient)

Expand Down Expand Up @@ -425,7 +425,7 @@ func TestRegisterSEESubscriptionReconnectsStreamOnError(t *testing.T) {
time.Sleep(SSEConnectWaitTime)

// This should make the SSE subscription fail and reconnect to another cluster member
endpoint1.Close()
endpoint1.CloseServer()

// Give it a bit of time so that the subscription can reconnect
time.Sleep(SSEConnectWaitTime)
Expand Down
5 changes: 5 additions & 0 deletions testing_utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,5 +319,10 @@ func (s *fakeServer) Close() {
}

func (e *endpoint) Close() {
e.Client.Stop()
e.CloseServer()
}

func (e *endpoint) CloseServer() {
e.Server.Close()
}

0 comments on commit 0fd6fa5

Please sign in to comment.