Skip to content

Commit

Permalink
Add support in job spec for backoffLimit (#143)
Browse files Browse the repository at this point in the history
  • Loading branch information
doriordan authored May 11, 2018
1 parent 61a199e commit bfd29f8
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
3 changes: 2 additions & 1 deletion client/src/main/scala/skuber/batch/Job.scala
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ object Job {
activeDeadlineSeconds: Option[Long] = None,
selector: Option[LabelSelector] = None,
manualSelector: Option[Boolean] = None,
template: Option[Pod.Template.Spec] = None)
template: Option[Pod.Template.Spec] = None,
backoffLimit: Option[Int] = None)

case class Status(conditions: Option[Condition] = None,
startTime: Option[Timestamp] = None,
Expand Down
3 changes: 2 additions & 1 deletion client/src/main/scala/skuber/json/batch/format/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ package object format {
(JsPath \ "activeDeadlineSeconds").formatNullable[Long] and
(JsPath \ "selector").formatNullableLabelSelector and
(JsPath \ "manualSelector").formatNullable[Boolean] and
(JsPath \ "template").formatNullable[Pod.Template.Spec]
(JsPath \ "template").formatNullable[Pod.Template.Spec] and
(JsPath \ "backoffLimit").formatNullable[Int]
)(Job.Spec.apply _, unlift(Job.Spec.unapply))

implicit val jobFormat: Format[Job] = (
Expand Down
6 changes: 5 additions & 1 deletion client/src/test/scala/skuber/batch/JobSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,18 @@ class JobSpec extends Specification {
| ],
| "restartPolicy": "Never"
| }
| }
| },
| "backoffLimit": 4,
| "activeDeadlineSeconds": 60
| }
|}
""".stripMargin

val job = Json.parse(jobJsonStr).as[Job]
job.kind mustEqual "Job"
job.name mustEqual "pi"
job.spec.get.activeDeadlineSeconds mustEqual Some(60)
job.spec.get.backoffLimit mustEqual Some(4)
val templateSpec: Template.Spec = job.spec.get.template.get
templateSpec.metadata.name mustEqual "templatename"
templateSpec.spec.get.restartPolicy mustEqual RestartPolicy.Never
Expand Down
2 changes: 0 additions & 2 deletions client/src/test/scala/skuber/json/NodeFormatSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ import play.api.libs.json._

import scala.io.Source



/**
* @author David O'Riordan
*/
Expand Down

0 comments on commit bfd29f8

Please sign in to comment.