Skip to content

Commit

Permalink
Merge pull request #3831 from mesosphere/gk/fixes-#3820
Browse files Browse the repository at this point in the history
Fixes #3820 - Fix deployment steps serialization
  • Loading branch information
aquamatthias committed Apr 25, 2016
2 parents 05efd28 + 595eba7 commit d249edb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ trait DeploymentFormats {

implicit lazy val DeploymentActionWrites: Writes[DeploymentAction] = Writes { action =>
Json.obj(
"type" -> action.getClass.getSimpleName,
"action" -> action.getClass.getSimpleName,
"app" -> action.app.id
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ class GroupsResourceTest extends MarathonSpec with Matchers with Mockito with Gi
assert(steps.size == 2)

val firstStep = (steps.head \ "actions").as[Seq[JsObject]].head
assert((firstStep \ "type").as[String] == "StartApplication")
assert((firstStep \ "action").as[String] == "StartApplication")
assert((firstStep \ "app").as[String] == "/test/app")

val secondStep = (steps.last \ "actions").as[Seq[JsObject]].head
assert((secondStep \ "type").as[String] == "ScaleApplication")
assert((secondStep \ "action").as[String] == "ScaleApplication")
assert((secondStep \ "app").as[String] == "/test/app")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,13 @@ class DeploymentFormatsTest extends MarathonSpec {
Seq(genStep),
Timestamp.now()
)
val json = Json.toJson(plan)
val fieldMap = json.as[JsObject].fields.toMap
val json = Json.toJson(plan).as[JsObject]
val fieldMap = json.fields.toMap
fieldMap.keySet should be(Set("version", "id", "target", "original", "steps"))

val action = ((json \ "steps")(0) \ "actions")(0)
val actionFields = action.as[JsObject].fields.toMap.keySet
actionFields should be(Set("action", "app"))
}

// regression test for #1176
Expand Down

0 comments on commit d249edb

Please sign in to comment.