Skip to content

Commit c61de63

Browse files
committed
Add test for utils.go
1 parent d96028f commit c61de63

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

network/utils_test.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package network
2+
3+
import (
4+
"testing"
5+
6+
"github.com/stretchr/testify/assert"
7+
)
8+
9+
func TestGetRlimit(t *testing.T) {
10+
rlimit := GetRLimit()
11+
assert.Greater(t, rlimit.Cur, uint64(1))
12+
assert.Greater(t, rlimit.Max, uint64(1))
13+
}
14+
15+
func TestGetID(t *testing.T) {
16+
id := GetID("tcp", "localhost:5432", 1)
17+
assert.Equal(t, "7b0a81105ebe3e390c617d9757feac3d5ea1a3d5", id)
18+
}
19+
20+
func TestResolve(t *testing.T) {
21+
address, err := Resolve("udp", "localhost:53")
22+
assert.NoError(t, err)
23+
assert.Equal(t, "127.0.0.1:53", address)
24+
}

0 commit comments

Comments
 (0)