This repository has been archived by the owner on Oct 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 841
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #5024 by using the correct validator for validating app depende…
…ncies. (#5027)
- Loading branch information
1 parent
1dc09c4
commit 25dd12d
Showing
2 changed files
with
49 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
src/test/scala/mesosphere/marathon/api/validation/AppDefinitionValidationTest.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package mesosphere.marathon | ||
package api.validation | ||
|
||
import mesosphere.UnitTest | ||
import mesosphere.marathon.core.plugin.PluginManager | ||
import mesosphere.marathon.state.{ AppDefinition, PathId } | ||
|
||
class AppDefinitionValidationTest extends UnitTest { | ||
|
||
"AppDefinition" when { | ||
|
||
"created with dependencies" should { | ||
|
||
"be valid with dependencies pointing to a a subtree of this app" in new Fixture { | ||
val app = AppDefinition( | ||
id = PathId("/a/b/c/d"), | ||
cmd = Some("sleep 1000"), | ||
dependencies = Set(PathId("/a/b/c/e")) | ||
) | ||
validator(app).isSuccess shouldBe true | ||
} | ||
|
||
"be valid with dependencies pointing to a different subtree (Regression for #5024)" in new Fixture { | ||
val app = AppDefinition( | ||
id = PathId("/a/b/c/d"), | ||
cmd = Some("sleep 1000"), | ||
dependencies = Set(PathId("/x/y/z")) | ||
) | ||
validator(app).isSuccess shouldBe true | ||
} | ||
|
||
"be invalid with dependencies with invalid path chars" in new Fixture { | ||
val app = AppDefinition( | ||
id = PathId("/a/b/c/d"), | ||
cmd = Some("sleep 1000"), | ||
dependencies = Set(PathId("/a/.../")) | ||
) | ||
validator(app).isSuccess shouldBe false | ||
} | ||
} | ||
} | ||
|
||
class Fixture { | ||
val validator = AppDefinition.validAppDefinition(PluginManager.None) | ||
} | ||
} |