-
Notifications
You must be signed in to change notification settings - Fork 50
/
nodes_network_test.go
69 lines (59 loc) · 1.24 KB
/
nodes_network_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package proxmox
import (
"context"
"testing"
"github.com/luthermonson/go-proxmox/tests/mocks"
"github.com/stretchr/testify/assert"
)
func TestNetwork(t *testing.T) {
mocks.On(mockConfig)
defer mocks.Off()
client := mockClient()
ctx := context.Background()
node := Node{
client: client,
Name: "node1",
}
network, err := node.Network(ctx, "vmbr0")
assert.Nil(t, err)
assert.Equal(t, network.Iface, "vmbr0")
}
func TestNode1Networks(t *testing.T) {
mocks.On(mockConfig)
defer mocks.Off()
client := mockClient()
ctx := context.Background()
node := Node{
client: client,
Name: "node1",
}
networks, err := node.Networks(ctx)
assert.Nil(t, err)
assert.Len(t, networks, 2)
}
func TestNode2Networks(t *testing.T) {
mocks.On(mockConfig)
defer mocks.Off()
client := mockClient()
ctx := context.Background()
node := Node{
client: client,
Name: "node2",
}
networks, err := node.Networks(ctx)
assert.Nil(t, err)
assert.Len(t, networks, 2)
}
func TestNetworksPve8(t *testing.T) {
mocks.ProxmoxVE8x(mockConfig)
defer mocks.Off()
client := mockClient()
ctx := context.Background()
node := Node{
client: client,
Name: "node1",
}
networks, err := node.Networks(ctx)
assert.Nil(t, err)
assert.Len(t, networks, 5)
}