summaryrefslogtreecommitdiffhomepage
path: root/dhcpv6/async_test.go
diff options
context:
space:
mode:
authorMikolaj Walczak <mwalczak@fb.com>2018-08-13 05:04:49 -0700
committerMikolaj Walczak <mwalczak@fb.com>2018-08-13 08:34:39 -0700
commit1c12a97ec2674a36612ddb4a4a627d407ee38b46 (patch)
tree31f5030f8e00517060f5801262d3470af06abeef /dhcpv6/async_test.go
parent9fd98c97defdcd39497c9d78925425cf7b9db053 (diff)
Move DHCPv6 async to seperate package
Diffstat (limited to 'dhcpv6/async_test.go')
-rw-r--r--dhcpv6/async_test.go54
1 files changed, 0 insertions, 54 deletions
diff --git a/dhcpv6/async_test.go b/dhcpv6/async_test.go
deleted file mode 100644
index 4f5a750..0000000
--- a/dhcpv6/async_test.go
+++ /dev/null
@@ -1,54 +0,0 @@
-package dhcpv6
-
-import (
- "net"
- "testing"
- "time"
-
- "github.com/stretchr/testify/require"
-)
-
-func TestNewAsyncClient(t *testing.T) {
- c := NewAsyncClient()
- require.NotNil(t, c)
- require.Equal(t, c.ReadTimeout, DefaultReadTimeout)
- require.Equal(t, c.ReadTimeout, DefaultWriteTimeout)
-}
-
-func TestOpenInvalidAddrFailes(t *testing.T) {
- c := NewAsyncClient()
- err := c.Open(512)
- require.Error(t, err)
-}
-
-// This test uses port 15438 so please make sure its not used before running
-func TestOpenClose(t *testing.T) {
- c := NewAsyncClient()
- addr, err := net.ResolveUDPAddr("udp6", ":15438")
- require.NoError(t, err)
- c.LocalAddr = addr
- err = c.Open(512)
- require.NoError(t, err)
- defer c.Close()
-}
-
-// This test uses ports 15438 and 15439 so please make sure they are not used
-// before running
-func TestSendTimeout(t *testing.T) {
- c := NewAsyncClient()
- addr, err := net.ResolveUDPAddr("udp6", ":15438")
- require.NoError(t, err)
- remote, err := net.ResolveUDPAddr("udp6", ":15439")
- require.NoError(t, err)
- c.ReadTimeout = 50 * time.Millisecond
- c.WriteTimeout = 50 * time.Millisecond
- c.LocalAddr = addr
- c.RemoteAddr = remote
- err = c.Open(512)
- require.NoError(t, err)
- defer c.Close()
- m, err := NewMessage()
- require.NoError(t, err)
- _, err = c.Send(m).WaitTimeout(200 * time.Millisecond)
- require.Error(t, err)
-}