Skip to content

Commit

Permalink
Fix port number in attach unit test (#4793)
Browse files Browse the repository at this point in the history
This commit changes the port number used for the attach server in
the unit test from -1 to 0 so the OS can assign it.
  • Loading branch information
Anchal Agrawal authored and mhagen-vmware committed Apr 14, 2017
1 parent ef542ea commit 5991c23
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/portlayer/attach/server_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2016 VMware, Inc. All Rights Reserved.
// Copyright 2016-2017 VMware, Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -35,16 +35,17 @@ import (
// Start the server, make 200 client connections, test they connect, then Stop.
func TestAttachStartStop(t *testing.T) {
log.SetLevel(log.InfoLevel)
s := NewAttachServer("", -1)
s := NewAttachServer("", 0)

wg := &sync.WaitGroup{}

dial := func() {
defer wg.Done()

c, err := net.Dial("tcp", s.l.Addr().String())
assert.NoError(t, err)
assert.NotNil(t, c)
if !assert.NoError(t, err) || !assert.NotNil(t, c) {
return
}
defer c.Close()

buf := make([]byte, 1)
Expand Down Expand Up @@ -88,7 +89,7 @@ func TestAttachStartStop(t *testing.T) {
func TestAttachSshSession(t *testing.T) {
log.SetLevel(log.InfoLevel)

s := NewAttachServer("", -1)
s := NewAttachServer("", 0)
assert.NoError(t, s.Start(true))
defer s.Stop()

Expand Down

0 comments on commit 5991c23

Please sign in to comment.