Skip to content

Commit

Permalink
make test passed
Browse files Browse the repository at this point in the history
  • Loading branch information
John-Lin committed Oct 4, 2018
1 parent 7532f4a commit a82fe05
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 15 deletions.
32 changes: 20 additions & 12 deletions src/deployment/deployment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,11 @@ func (suite *DeploymentTestSuite) TestGenerateConfigMap() {
func (suite *DeploymentTestSuite) TestCreateDeployment() {
containers := []entity.Container{
{
Name: namesgenerator.GetRandomName(0),
Image: "busybox",
Command: []string{"sleep", "3600"},
Name: namesgenerator.GetRandomName(0),
Image: "busybox",
Command: []string{"sleep", "3600"},
ResourceRequestCPU: 40,
ResourceRequestMemory: 0,
},
}

Expand All @@ -195,9 +197,11 @@ func (suite *DeploymentTestSuite) TestCreateDeployment() {
func (suite *DeploymentTestSuite) TestCreateDeploymentFailWithoutVolume() {
containers := []entity.Container{
{
Name: namesgenerator.GetRandomName(0),
Image: "busybox",
Command: []string{"sleep", "3600"},
Name: namesgenerator.GetRandomName(0),
Image: "busybox",
Command: []string{"sleep", "3600"},
ResourceRequestCPU: 0,
ResourceRequestMemory: 0,
},
}

Expand All @@ -218,9 +222,11 @@ func (suite *DeploymentTestSuite) TestCreateDeploymentFailWithoutVolume() {
func (suite *DeploymentTestSuite) TestCreateDeploymentFailWithoutNetwork() {
containers := []entity.Container{
{
Name: namesgenerator.GetRandomName(0),
Image: "busybox",
Command: []string{"sleep", "3600"},
Name: namesgenerator.GetRandomName(0),
Image: "busybox",
Command: []string{"sleep", "3600"},
ResourceRequestCPU: 0,
ResourceRequestMemory: 0,
},
}

Expand Down Expand Up @@ -482,9 +488,11 @@ func (suite *DeploymentTestSuite) TestCreateDeploymentWithNetworkTypes() {
func (suite *DeploymentTestSuite) TestCreateDeploymentWithAutoscaler() {
containers := []entity.Container{
{
Name: namesgenerator.GetRandomName(0),
Image: "busybox",
Command: []string{"sleep", "3600"},
Name: namesgenerator.GetRandomName(0),
Image: "busybox",
Command: []string{"sleep", "3600"},
ResourceRequestCPU: 0,
ResourceRequestMemory: 30,
},
}

Expand Down
2 changes: 1 addition & 1 deletion src/entity/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ type Deployment struct {
Capability bool `bson:"capability" json:"capability" validate:"-"`
NetworkType string `bson:"networkType" json:"networkType" validate:"required,eq=host|eq=cluster|eq=custom"`
NodeAffinity []string `bson:"nodeAffinity" json:"nodeAffinity" validate:"required"`
IsCapableAutoscaleResources []string `bson:"isCapableAutoscaleResources" json:"isCapableAutoscaleResources" validate:"required,dive,required,eq=memory|eq=cpu"`
IsCapableAutoscaleResources []string `bson:"isCapableAutoscaleResources" json:"isCapableAutoscaleResources" validate:"-"`
IsEnableAutoscale bool `bson:"isEnableAutoscale" json:"isEnableAutoscale" validate:"-"`
AutoscalerInfo AutoscalerInfo `bson:"autoscalerInfo" json:"autoscalerInfo" validate:"-"`
CreatedBy User `json:"createdBy" validate:"-"`
Expand Down
2 changes: 1 addition & 1 deletion tests/05-deployment/deployment.info
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"myip":"1.2.3.4"
},
"namespace":"default",
"isCapableAutoscaleResources": [],
"isCapableAutoscaleResources":[],
"containers":[
{
"name":"first-container",
Expand Down
5 changes: 4 additions & 1 deletion tests/07-ovs/deployment.info
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
"labels":{},
"envVars":{},
"namespace":"default",
"isCapableAutoscaleResources":[],
"containers":[
{
"name":"first-container",
"image":"busybox",
"command":["sleep","3600"]
"command":["sleep","3600"],
"resourceRequestCPU": 0,
"resourceRequestMemory": 0
}
],
"networks":[
Expand Down

0 comments on commit a82fe05

Please sign in to comment.