summaryrefslogtreecommitdiff
path: root/utils/network_test.go
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2020-12-27 00:59:10 +0300
committerValery Piashchynski <[email protected]>2020-12-27 00:59:10 +0300
commit8df4896deabdab9a50a5ad3c6da6e1c7f05922af (patch)
treec2fa71733902b999c02e5abd608bff4bc7449c5c /utils/network_test.go
parent1aaf6e6ffb015cd5a21d9d938ad84c18723973c5 (diff)
Util -> Utils
Diffstat (limited to 'utils/network_test.go')
-rwxr-xr-xutils/network_test.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/utils/network_test.go b/utils/network_test.go
new file mode 100755
index 00000000..cfed98f9
--- /dev/null
+++ b/utils/network_test.go
@@ -0,0 +1,23 @@
+// +build linux darwin freebsd
+
+package utils
+
+import (
+ "testing"
+
+ "github.com/stretchr/testify/assert"
+)
+
+func TestCreateListener(t *testing.T) {
+ _, err := CreateListener("unexpected dsn")
+ assert.Error(t, err, "Invalid DSN (tcp://:6001, unix://file.sock)")
+
+ _, err = CreateListener("aaa://192.168.0.1")
+ assert.Error(t, err, "Invalid Protocol (tcp://:6001, unix://file.sock)")
+}
+
+func TestUnixCreateListener(t *testing.T) {
+ l, err := CreateListener("unix://file.sock")
+ assert.NoError(t, err)
+ l.Close()
+}