Skip to content

Commit

Permalink
Merge 59a1946 into cd761d4
Browse files Browse the repository at this point in the history
  • Loading branch information
unterstein committed Aug 17, 2016
2 parents cd761d4 + 59a1946 commit 5798db1
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ case class AppUpdate(
backoff = backoff.getOrElse(app.backoff),
backoffFactor = backoffFactor.getOrElse(app.backoffFactor),
maxLaunchDelay = maxLaunchDelay.getOrElse(app.maxLaunchDelay),
container = app.container,
container = container.orElse(app.container),
healthChecks = healthChecks.getOrElse(app.healthChecks),
readinessChecks = readinessChecks.getOrElse(app.readinessChecks),
dependencies = dependencies.map(_.map(_.canonicalPath(app.id))).getOrElse(app.dependencies),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -638,5 +638,50 @@ class AppDeployIntegrationTest
maybeContainer1.get.docker shouldBe (empty)
}

test("create a simple app with a docker container and update it") {
import scala.collection.immutable.Seq

Given("a new app")
val appId = testBasePath / "app"

val container = Container.Docker(
network = Some(org.apache.mesos.Protos.ContainerInfo.DockerInfo.Network.BRIDGE),
image = "jdef/helpme",
portMappings = Some(Seq(
Container.Docker.PortMapping(containerPort = 3000, protocol = "tcp")
))
)

val app = AppDefinition(
id = appId,
cmd = Some("cmd"),
container = Some(container),
instances = 0
)

When("The app is deployed")
val result = marathon.createAppV2(app)

Then("The app is created")
result.code should be (201) //Created
extractDeploymentIds(result) should have size 1
waitForEvent("deployment_success")

val appUpdate = AppUpdate(container = Some(container.copy(portMappings = Some(Seq(
Container.Docker.PortMapping(containerPort = 4000, protocol = "tcp")
)))))
val updateResult = marathon.updateApp(app.id, appUpdate, true)

And("The app is updated")
updateResult.code should be (200)

Then("The container is updated correctly")
val updatedApp = marathon.app(appId)
updatedApp.value.app.container should not be None
updatedApp.value.app.container.get.portMappings should not be None
updatedApp.value.app.container.get.portMappings.get should have size 1
updatedApp.value.app.container.get.portMappings.get.head.containerPort should be (4000)
}

def healthCheck = HealthCheck(gracePeriod = 20.second, interval = 1.second, maxConsecutiveFailures = 10)
}

0 comments on commit 5798db1

Please sign in to comment.