mirror of https://github.com/kubernetes/kops.git
Add unit test for func RenderInstanceGroupSubnets in instancegroup.go
Signed-off-by: Guangwen Feng <fenggw-fnst@cn.fujitsu.com>
This commit is contained in:
parent
a65422dd46
commit
d80aed0c9d
|
@ -71,3 +71,36 @@ func TestRenderInstanceGroupZones(t *testing.T) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestRenderInstanceGroupSubnets(t *testing.T) {
|
||||
cluster := &kops.Cluster{}
|
||||
grid := []struct {
|
||||
ig *kops.InstanceGroup
|
||||
expected string
|
||||
}{
|
||||
{
|
||||
ig: &kops.InstanceGroup{
|
||||
Spec: kops.InstanceGroupSpec{
|
||||
Subnets: []string{"subnet"},
|
||||
},
|
||||
},
|
||||
expected: "subnet",
|
||||
},
|
||||
{
|
||||
ig: &kops.InstanceGroup{
|
||||
Spec: kops.InstanceGroupSpec{
|
||||
Subnets: []string{"subnet1", "subnet2"},
|
||||
},
|
||||
},
|
||||
expected: "subnet1,subnet2",
|
||||
},
|
||||
}
|
||||
for _, g := range grid {
|
||||
f := RenderInstanceGroupSubnets(cluster)
|
||||
actual := f(g.ig)
|
||||
if actual != g.expected {
|
||||
t.Errorf("unexpected output: %q vs %q", g.expected, actual)
|
||||
continue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue