Skip to content

Commit beae87d

Browse files
committed
add more tests
Signed-off-by: Date Huang <[email protected]>
1 parent e642eb8 commit beae87d

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

plugins/main/bridge/bridge_test.go

+24-4
Original file line numberDiff line numberDiff line change
@@ -1765,10 +1765,13 @@ var _ = Describe("bridge Operations", func() {
17651765
})
17661766

17671767
var (
1768-
correctMinID int = 100
1769-
correctMaxID int = 105
1770-
overID int = 5000
1771-
negativeID int = -1
1768+
correctID int = 10
1769+
correctMinID int = 100
1770+
correctMaxID int = 105
1771+
incorrectMinID int = 1000
1772+
incorrectMaxID int = 100
1773+
overID int = 5000
1774+
negativeID int = -1
17721775
)
17731776

17741777
DescribeTable(
@@ -1783,6 +1786,20 @@ var _ = Describe("bridge Operations", func() {
17831786
MaxID: &correctMaxID,
17841787
},
17851788
}, []int{100, 101, 102, 103, 104, 105}),
1789+
Entry("when provided a VLAN trunk configuration with id only", []*VlanTrunk{
1790+
{
1791+
ID: &correctID,
1792+
},
1793+
}, []int{10}),
1794+
Entry("when provided a VLAN trunk configuration with id and range", []*VlanTrunk{
1795+
{
1796+
ID: &correctID,
1797+
},
1798+
{
1799+
MinID: &correctMinID,
1800+
MaxID: &correctMaxID,
1801+
},
1802+
}, []int{10, 100, 101, 102, 103, 104, 105}),
17861803
)
17871804

17881805
DescribeTable(
@@ -1797,6 +1814,9 @@ var _ = Describe("bridge Operations", func() {
17971814
Entry("when the minID is larger than 4094", []*VlanTrunk{{MinID: &overID, MaxID: &correctMaxID}}, fmt.Errorf("incorrect trunk minID parameter")),
17981815
Entry("when the maxID is larger than 4094", []*VlanTrunk{{MinID: &correctMinID, MaxID: &overID}}, fmt.Errorf("incorrect trunk maxID parameter")),
17991816
Entry("when the maxID is negative", []*VlanTrunk{{MinID: &correctMinID, MaxID: &overID}}, fmt.Errorf("incorrect trunk maxID parameter")),
1817+
Entry("when the ID is larger than 4094", []*VlanTrunk{{ID: &overID}}, fmt.Errorf("incorrect trunk id parameter")),
1818+
Entry("when the ID is negative", []*VlanTrunk{{ID: &negativeID}}, fmt.Errorf("incorrect trunk id parameter")),
1819+
Entry("when the maxID is smaller than minID", []*VlanTrunk{{MinID: &incorrectMinID, MaxID: &incorrectMaxID}}, fmt.Errorf("minID is greater than maxID in trunk parameter")),
18001820
)
18011821

18021822
for _, ver := range testutils.AllSpecVersions {

0 commit comments

Comments
 (0)