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

Commit

Permalink
Making ipv4/v6 agnostic for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
RichardoC committed Mar 10, 2020
1 parent c535449 commit bf42e2b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var log = logrus.New()

var opts struct {
HostPort string `long:"host_port" default:"8080" description:"Port to host on"`
DestHost string `long:"dst_hst" default:"127.0.0.1:8080" description:"Destination host to target for tests"`
DestHost string `long:"dst_hst" default:"localhost:8080" description:"Destination host to target for tests"`
TimeBetTests float64 `long:"wait_time" default:"5" description:"Minimum time between individual tests"`
RandTimeTest float64 `long:"rand_secs" default:"5.0" description:"Maximum random time to be added to TimeBetTests"`
ShortTestBytes int `long:"short_test_bytes" default:"10" description:"Bytes to use for short tests"`
Expand Down
14 changes: 7 additions & 7 deletions src/tcpconn/tcpconn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
// TestOnceSmallPacketOneConn sends one small packet using one connection
func TestOnceSmallPacketOneConn(t *testing.T) {
addr := "0.0.0.0:9999"
s, err := net.Listen("tcp4", addr)
s, err := net.Listen("tcp", addr)

assert.Nil(t, err)
defer s.Close()
Expand All @@ -31,7 +31,7 @@ func TestOnceSmallPacketOneConn(t *testing.T) {
// Note that the port used each time may be different
func TestMultiSmallPacketsSeqConn(t *testing.T) {
addr := "0.0.0.0:9998"
s, err := net.Listen("tcp4", addr)
s, err := net.Listen("tcp", addr)

assert.Nil(t, err)
defer s.Close()
Expand Down Expand Up @@ -59,7 +59,7 @@ func makeConnection(t *testing.T, ch chan bool, addr string, timeBetSend float64
// Depending on the local environment, the test may fail if there are too many sockets being used at the same time
func TestMultiSmallPacketsConcConn(t *testing.T) {
addr := "0.0.0.0:9997"
s, err := net.Listen("tcp4", addr)
s, err := net.Listen("tcp", addr)

assert.Nil(t, err)
defer s.Close()
Expand Down Expand Up @@ -91,7 +91,7 @@ func TestMultiSmallPacketsConcConn(t *testing.T) {
// **Cumulative connections toned down to 500 while investigating a minor connection issue**
func TestCumulativeConnections(t *testing.T) {
addr := "0.0.0.0:9996"
s, err := net.Listen("tcp4", addr)
s, err := net.Listen("tcp", addr)

assert.Nil(t, err)
defer s.Close()
Expand Down Expand Up @@ -123,7 +123,7 @@ func TestCumulativeConnections(t *testing.T) {
// TestMultiLargePacketsSeqConn sends many very large packets using one connection at a time
func TestMultiLargePacketsSeqConn(t *testing.T) {
addr := "0.0.0.0:9995"
s, err := net.Listen("tcp4", addr)
s, err := net.Listen("tcp", addr)

assert.Nil(t, err)
defer s.Close()
Expand All @@ -142,7 +142,7 @@ func TestMultiLargePacketsSeqConn(t *testing.T) {
// A different port are used each time a package is sent
func TestMultiLargePacketsConcConn(t *testing.T) {
addr := "0.0.0.0:9994"
s, err := net.Listen("tcp4", addr)
s, err := net.Listen("tcp", addr)

assert.Nil(t, err)
defer s.Close()
Expand All @@ -169,7 +169,7 @@ func TestMultiLargePacketsConcConn(t *testing.T) {
// TestInvalidConn uses an invalid address which the client tries to dial and checks that errors are returned as expected
func TestInvalidConn(t *testing.T) {
addr := "0.0.0.0:9993"
s, err := net.Listen("tcp4", addr)
s, err := net.Listen("tcp", addr)

assert.Nil(t, err)
defer s.Close()
Expand Down

0 comments on commit bf42e2b

Please sign in to comment.