Merge pull request #8955 from hs0210/work

Add unit test for func JoinSuffixes
This commit is contained in:
Kubernetes Prow Robot 2020-04-22 05:15:52 -07:00 committed by GitHub
commit bb48a8ce06
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 31 additions and 0 deletions

View File

@ -60,3 +60,34 @@ func Test_SharedGroups(t *testing.T) {
}
}
}
func TestJoinSuffixes(t *testing.T) {
grid := []struct {
src SecurityGroupInfo
dest SecurityGroupInfo
expected string
}{
{
src: SecurityGroupInfo{Suffix: ""},
dest: SecurityGroupInfo{Suffix: ""},
expected: "",
},
{
src: SecurityGroupInfo{Suffix: "srcSuffix"},
dest: SecurityGroupInfo{Suffix: ""},
expected: "srcSuffix-default",
},
{
src: SecurityGroupInfo{Suffix: ""},
dest: SecurityGroupInfo{Suffix: "destSuffix"},
expected: "-defaultdestSuffix",
},
}
for _, g := range grid {
actual := JoinSuffixes(g.src, g.dest)
if actual != g.expected {
t.Errorf("unexpected result. expected %q, got %q", g.expected, actual)
}
}
}