Skip to content
This repository has been archived by the owner on Apr 2, 2018. It is now read-only.

Commit

Permalink
use predefined port for syslog server
Browse files Browse the repository at this point in the history
random ports are conflicting with some ports in use

[#117078735]

Signed-off-by: Evan Short <[email protected]>
  • Loading branch information
mariash authored and evashort committed Apr 6, 2016
1 parent 4341c60 commit 245e3a6
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions integration/blackbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"os"
"os/exec"

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"gopkg.in/yaml.v2"

Expand All @@ -33,21 +34,25 @@ func NewSyslogServer(inbox *Inbox) *SyslogServer {
}

func (s *SyslogServer) Start() {
l, err := net.Listen("tcp", ":0")
port := fmt.Sprintf("%d", 9090+GinkgoParallelNode())
l, err := net.Listen("tcp", ":"+port)
Expect(err).NotTo(HaveOccurred())
l.Close()

_, port, err := net.SplitHostPort(l.Addr().String())
Expect(err).NotTo(HaveOccurred())

addr := fmt.Sprintf("127.0.0.1:%s", port)
s.server.Listen(addr)
err = s.server.Listen(addr)
Expect(err).NotTo(HaveOccurred())

s.Addr = addr
}

func (s *SyslogServer) Stop() {
s.server.Shutdown()
Eventually(func() error {
_, err := net.Dial("tcp", s.Addr)
return err
}).ShouldNot(BeNil())

s.Addr = ""
}

Expand Down

0 comments on commit 245e3a6

Please sign in to comment.