Skip to content

Commit

Permalink
api,service: persist plan name update on storage
Browse files Browse the repository at this point in the history
  • Loading branch information
andrestc committed Apr 24, 2018
1 parent 355c5f3 commit 5759b9f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions api/service_instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -758,6 +758,7 @@ func (s *ServiceInstanceSuite) TestUpdateServiceInstancePlan(c *check.C) {
Apps: []string{"other"},
Teams: []string{s.team.Name},
TeamOwner: s.team.Name,
PlanName: "plan",
}
err := s.conn.ServiceInstances().Insert(si)
c.Assert(err, check.IsNil)
Expand All @@ -779,6 +780,9 @@ func (s *ServiceInstanceSuite) TestUpdateServiceInstancePlan(c *check.C) {
{"name": "plan", "value": "newplan"},
},
}, eventtest.HasEvent)
instance, err := service.GetServiceInstance("mysql", "brainsql")
c.Assert(err, check.IsNil)
c.Assert(instance.PlanName, check.Equals, "newplan")
}

func (s *ServiceInstanceSuite) TestUpdateServiceInstanceEmptyFields(c *check.C) {
Expand Down
2 changes: 2 additions & 0 deletions service/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ var updateServiceInstance = action.Action{
"description": updateData.Description,
"tags": updateData.Tags,
"teamowner": updateData.TeamOwner,
"plan_name": updateData.PlanName,
},
"$addToSet": bson.M{
"teams": updateData.TeamOwner,
Expand All @@ -165,6 +166,7 @@ var updateServiceInstance = action.Action{
"tags": instance.Tags,
"teamowner": instance.TeamOwner,
"teams": instance.Teams,
"plan_name": instance.PlanName,
},
},
)
Expand Down

0 comments on commit 5759b9f

Please sign in to comment.