Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

Commit

Permalink
Fixes #5024 by using the correct validator for validating app depende…
Browse files Browse the repository at this point in the history
…ncies. (#5026)
  • Loading branch information
aquamatthias authored Jan 27, 2017
1 parent 933581f commit d9e16e1
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ object AppDefinition {
implicit val validAppDefinition: Validator[AppDefinition] = validator[AppDefinition] { app =>
app.id is valid
app.id is PathId.absolutePathValidator
app.dependencies is every(PathId.validPathWithBase(app.id.parent))
app.dependencies is valid
} and validBasicAppDefinition

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,33 @@ class AppDefinitionValidatorTest extends MarathonSpec with Matchers with GivenWh
result.isSuccess shouldBe true
}

test("valid with dependencies pointing to a a subtree of an app") {
val app = AppDefinition(
id = PathId("/a/b/c/d"),
cmd = Some("sleep 1000"),
dependencies = Set(PathId("/a/b/c/e"))
)
AppDefinition.validAppDefinition(app).isSuccess shouldBe true
}

test("be valid with dependencies pointing to a different subtree (Regression for #5024)") {
val app = AppDefinition(
id = PathId("/a/b/c/d"),
cmd = Some("sleep 1000"),
dependencies = Set(PathId("/x/y/z"))
)
AppDefinition.validAppDefinition(app).isSuccess shouldBe true
}

test("be invalid with dependencies with invalid path chars") {
val app = AppDefinition(
id = PathId("/a/b/c/d"),
cmd = Some("sleep 1000"),
dependencies = Set(PathId("/a/.../"))
)
AppDefinition.validAppDefinition(app).isSuccess shouldBe false
}

class Fixture {
def validDockerContainer: Container = Container(
`type` = mesos.ContainerInfo.Type.DOCKER,
Expand Down

0 comments on commit d9e16e1

Please sign in to comment.