Skip to content
This repository has been archived by the owner on Mar 9, 2022. It is now read-only.

Commit

Permalink
Be systematic about ports used in tests
Browse files Browse the repository at this point in the history
Avoid port collisions when tests are run in parallel.
  • Loading branch information
mjs committed May 8, 2018
1 parent 69b3777 commit 830386c
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 26 deletions.
4 changes: 2 additions & 2 deletions filter/filter_medium_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ import (
"github.com/jumptrading/influx-spout/spouttest"
)

const natsPort = 44446
const probePort = 44447
const natsPort = 44100
const probePort = 44101

func testConfig() *config.Config {
return &config.Config{
Expand Down
6 changes: 3 additions & 3 deletions listener/listener_medium_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ import (
)

const (
natsPort = 44444
listenPort = 44445
probePort = 44446
natsPort = 44000
listenPort = 44001
probePort = 44002
natsSubject = "listener-test"
natsMonitorSubject = natsSubject + "-monitor"
)
Expand Down
6 changes: 3 additions & 3 deletions monitor/monitor_medium_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ import (
"github.com/jumptrading/influx-spout/spouttest"
)

const natsPort = 44447
const httpPort = 44448
const probePort = 44449
const natsPort = 44300
const httpPort = 44301
const probePort = 44302

var natsAddress = fmt.Sprintf("nats://127.0.0.1:%d", natsPort)

Expand Down
30 changes: 15 additions & 15 deletions spouttest/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,21 @@ import (
)

const (
natsPort = 44500
influxdPort = 44501
natsPort = 44600
influxdPort = 44601

listenerPort = 44502
listenerProbePort = 55502
listenerPort = 44610
listenerProbePort = 44611

httpListenerPort = 44503
httpListenerProbePort = 55503
httpListenerPort = 44620
httpListenerProbePort = 44621

filterProbePort = 55504
filterProbePort = 44631

writerProbePort = 55505
writerProbePort = 44641

monitorPort = 44506
monitorProbePort = 55506
monitorPort = 44650
monitorProbePort = 44651

influxDBName = "test"
sendCount = 10
Expand Down Expand Up @@ -143,20 +143,20 @@ func TestEndToEnd(t *testing.T) {
expectedMetrics := regexp.MustCompile(`
failed_nats_publish{component="filter",name="filter"} 0
failed_nats_publish{component="listener",name="listener"} 0
failed_writes{component="writer",influxdb_address="localhost",influxdb_dbname="test",influxdb_port="44501",name="writer"} 0
failed_writes{component="writer",influxdb_address="localhost",influxdb_dbname="test",influxdb_port="44601",name="writer"} 0
invalid_time{component="filter",name="filter"} 0
max_pending{component="writer",influxdb_address="localhost",influxdb_dbname="test",influxdb_port="44501",name="writer"} \d+
max_pending{component="writer",influxdb_address="localhost",influxdb_dbname="test",influxdb_port="44601",name="writer"} \d+
nats_dropped{component="filter",name="filter"} 0
nats_dropped{component="writer",influxdb_address="localhost",influxdb_dbname="test",influxdb_port="44501",name="writer",subject="system"} 0
nats_dropped{component="writer",influxdb_address="localhost",influxdb_dbname="test",influxdb_port="44601",name="writer",subject="system"} 0
passed{component="filter",name="filter"} 10
processed{component="filter",name="filter"} 20
read_errors{component="listener",name="listener"} 0
received{component="listener",name="listener"} 5
received{component="writer",influxdb_address="localhost",influxdb_dbname="test",influxdb_port="44501",name="writer"} 2
received{component="writer",influxdb_address="localhost",influxdb_dbname="test",influxdb_port="44601",name="writer"} 2
rejected{component="filter",name="filter"} 10
sent{component="listener",name="listener"} 1
triggered{component="filter",name="filter",rule="system"} 10
write_requests{component="writer",influxdb_address="localhost",influxdb_dbname="test",influxdb_port="44501",name="writer"} 2
write_requests{component="writer",influxdb_address="localhost",influxdb_dbname="test",influxdb_port="44601",name="writer"} 2
$`[1:])
var lines string
for try := 0; try < 20; try++ {
Expand Down
6 changes: 3 additions & 3 deletions writer/writer_medium_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ import (
"github.com/jumptrading/influx-spout/spouttest"
)

const natsPort = 44443
const influxPort = 44445
const probePort = 44446
const natsPort = 44200
const influxPort = 44201
const probePort = 44202

var natsAddress = fmt.Sprintf("nats://127.0.0.1:%d", natsPort)

Expand Down

0 comments on commit 830386c

Please sign in to comment.