-
Notifications
You must be signed in to change notification settings - Fork 0
/
main_test.go
36 lines (30 loc) · 917 Bytes
/
main_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
package main
import "testing"
func TestLabelGroups(t *testing.T) {
type test struct {
pods int
index int
label string
}
tests := []test{
{pods: 10, index: 1, label: "group1"},
{pods: 10, index: 4, label: "group2"},
{pods: 10, index: 6, label: "group3"},
{pods: 10, index: 9, label: "group4"},
{pods: 75, index: 7, label: "group1"},
{pods: 75, index: 10, label: "group2"},
{pods: 75, index: 30, label: "group3"},
{pods: 75, index: 60, label: "group4"},
{pods: 250, index: 1, label: "group1"},
{pods: 250, index: 24, label: "group1"},
{pods: 250, index: 30, label: "group2"},
{pods: 250, index: 150, label: "group3"},
{pods: 250, index: 201, label: "group4"},
}
for _, test := range tests {
label := getLabelGroup(test.pods, test.index)
if label != test.label {
t.Fatalf("For index=%d,pods=%d expected: %v, got: %v", test.index, test.pods, label, test.label)
}
}
}