Skip to content

Commit

Permalink
Merge pull request #8245 from fenggw-fnst/work
Browse files Browse the repository at this point in the history
Add unit test for func RenderInstanceGroupSubnets in instancegroup.go
  • Loading branch information
k8s-ci-robot committed Jan 13, 2020
2 parents c129752 + d80aed0 commit 09e27ef
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions pkg/formatter/instancegroup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}

0 comments on commit 09e27ef

Please sign in to comment.