Skip to content

Commit

Permalink
Merge pull request #636 from nats-io/restore_default_test_options_port
Browse files Browse the repository at this point in the history
Restore DefaultTestOptions port to 4222
  • Loading branch information
kozlovic committed Mar 7, 2018
2 parents fa662bb + 72bbd2b commit dd3dccc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 9 additions & 3 deletions test/gosrv_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ import (

func TestSimpleGoServerShutdown(t *testing.T) {
base := runtime.NumGoroutine()
s := RunDefaultServer()
opts := DefaultTestOptions
opts.Port = -1
s := RunServer(&opts)
s.Shutdown()
time.Sleep(100 * time.Millisecond)
delta := (runtime.NumGoroutine() - base)
Expand All @@ -22,7 +24,9 @@ func TestSimpleGoServerShutdown(t *testing.T) {

func TestGoServerShutdownWithClients(t *testing.T) {
base := runtime.NumGoroutine()
s := RunDefaultServer()
opts := DefaultTestOptions
opts.Port = -1
s := RunServer(&opts)
addr := s.Addr().(*net.TCPAddr)
for i := 0; i < 50; i++ {
createClientConn(t, "localhost", addr.Port)
Expand All @@ -39,7 +43,9 @@ func TestGoServerShutdownWithClients(t *testing.T) {
}

func TestGoServerMultiShutdown(t *testing.T) {
s := RunDefaultServer()
opts := DefaultTestOptions
opts.Port = -1
s := RunServer(&opts)
s.Shutdown()
s.Shutdown()
}
2 changes: 1 addition & 1 deletion test/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type tLogger interface {
// DefaultTestOptions are default options for the unit tests.
var DefaultTestOptions = server.Options{
Host: "localhost",
Port: -1,
Port: 4222,
NoLog: true,
NoSigs: true,
MaxControlLine: 256,
Expand Down

0 comments on commit dd3dccc

Please sign in to comment.