Skip to content

Commit

Permalink
Merge pull request #83 from linkernetworks/hwchiu/VX-160
Browse files Browse the repository at this point in the history
Fix the case name and refine the testing approach of check parameter …

Former-commit-id: f5a3c32cfa01578b7d0cbac63f51038015cd7055 [formerly f5a3c32cfa01578b7d0cbac63f51038015cd7055 [formerly d252352]]
Former-commit-id: 7485eb09ddd0b49264e3b6c23c366928e6d94a21
Former-commit-id: 4957fcb
  • Loading branch information
Hung-Wei Chiu authored Jul 11, 2018
2 parents 18a02f9 + 4655eef commit 207d514
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/networkprovider/ovs_netdev_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ func (suite *DPDKNetworkTestSuite) TestValidateBeforeCreatingFail() {
network *entity.Network
mongo bool
}{
{"invalidValid", &network, false},
{"invalidVlan", &network, false},
{"singelNetwork", &suite.singleNetwork, true},
{"clusterNetwork", &suite.clusterNetwork, true},
}
Expand Down
2 changes: 1 addition & 1 deletion src/networkprovider/ovs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ func (suite *NetworkTestSuite) TestValidateBeforeCreatingFail() {
network *entity.Network
mongo bool
}{
{"invalidValid", &network, false},
{"invalidVlan", &network, false},
{"singelNetwork", &suite.singleNetwork, true},
{"clusterNetwork", &suite.clusterNetwork, true},
}
Expand Down
25 changes: 18 additions & 7 deletions src/pod/pod_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,27 @@ func (suite *PodTestSuite) TestCheckPodParameter() {
}

func (suite *PodTestSuite) TestCheckPodParameterFail() {
volumeName := namesgenerator.GetRandomName(0)
pod := &entity.Pod{
ID: bson.NewObjectId(),
Volumes: []entity.PodVolume{
{Name: volumeName},
testCases := []struct {
caseName string
pod *entity.Pod
}{
{
"InvalidVolume", &entity.Pod{
ID: bson.NewObjectId(),
Name: namesgenerator.GetRandomName(0),
Volumes: []entity.PodVolume{
{Name: namesgenerator.GetRandomName(0)},
},
},
},
}

err := CheckPodParameter(suite.sp, pod)
suite.Error(err)
for _, tc := range testCases {
suite.T().Run(tc.caseName, func(t *testing.T) {
err := CheckPodParameter(suite.sp, tc.pod)
suite.Error(err)
})
}
}

func (suite *PodTestSuite) TestGenerateVolume() {
Expand Down

0 comments on commit 207d514

Please sign in to comment.