forked from labring/sealos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lvscare_test.go
84 lines (81 loc) · 1.52 KB
/
lvscare_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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
package ipvs
import (
"testing"
)
var want = []string{
`apiVersion: v1
kind: Pod
metadata:
creationTimestamp: null
labels:
component: kube-sealyun-lvscare
tier: control-plane
name: kube-sealyun-lvscare
namespace: kube-system
spec:
containers:
- args:
- care
- --vs
- 10.10.10.10:6443
- --health-path
- /healthz
- --health-schem
- https
- --rs
- 116.31.96.134:6443
- --rs
- 116.31.96.135:6443
- --rs
- 116.31.96.136:6443
command:
- /usr/bin/lvscare
image: fanux/lvscare:latest
imagePullPolicy: IfNotPresent
name: kube-sealyun-lvscare
resources: {}
securityContext:
privileged: true
volumeMounts:
- mountPath: /lib/modules
name: lib-modules
readOnly: true
hostNetwork: true
priorityClassName: system-cluster-critical
volumes:
- hostPath:
path: /lib/modules
type: ""
name: lib-modules
status: {}
`,
}
func TestLvsStaticPodYaml(t *testing.T) {
type args struct {
vip string
masters []string
image string
}
tests := []struct {
name string
args args
want string
}{
{
"test generate lvscare static pod",
args{
"10.10.10.10",
[]string{"116.31.96.134:3126", "116.31.96.135:3126", "116.31.96.136:3126"},
"",
},
want[0],
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := LvsStaticPodYaml(tt.args.vip, tt.args.masters, tt.args.image); got != tt.want {
t.Errorf("LvsStaticPodYaml() = %v, want %v", got, tt.want)
}
})
}
}