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 …
  • Loading branch information
Hung-Wei Chiu authored Jul 11, 2018
2 parents e5d2fe7 + 662ce14 commit 0aa0f67
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 0aa0f67

Please sign in to comment.