diff --git a/src/main/scala/mesosphere/marathon/state/AppDefinition.scala b/src/main/scala/mesosphere/marathon/state/AppDefinition.scala index ad433038ef2..71994fb1eb6 100644 --- a/src/main/scala/mesosphere/marathon/state/AppDefinition.scala +++ b/src/main/scala/mesosphere/marathon/state/AppDefinition.scala @@ -7,7 +7,7 @@ import com.wix.accord.combinators.GeneralPurposeCombinators import com.wix.accord.dsl._ import mesosphere.marathon.Protos.Constraint import mesosphere.marathon.Protos.HealthCheckDefinition.Protocol -import mesosphere.marathon.state.Container.{ Mesos, MesosAppC, MesosDocker } +import mesosphere.marathon.state.Container.Docker // scalastyle:off import mesosphere.marathon.api.serialization.{ ContainerSerializer, EnvVarRefSerializer, PortDefinitionSerializer, ResidencySerializer, SecretsSerializer } // scalastyle:on @@ -684,18 +684,15 @@ object AppDefinition extends GeneralPurposeCombinators { (appDef.isResident is false) or (appDef.upgradeStrategy is UpgradeStrategy.validForResidentTasks) } - private val complyWithGpuRules: Validator[AppDefinition] = conditional[AppDefinition](_.gpus > 0) { - isTrue[AppDefinition]("GPU resources only work with the Mesos containerizer") { app => - app.container.exists{ - _ match { - case _: MesosDocker => true - case _: MesosAppC => true - case _: Mesos => true - case _ => false + private val complyWithGpuRules: Validator[AppDefinition] = + conditional[AppDefinition](_.gpus > 0) { + isTrue[AppDefinition]("GPU resources only work with the Mesos containerizer") { app => + app.container match { + case Some(_: Docker) => false + case _ => true } - } - } and featureEnabled(Features.GPU_RESOURCES) - } + } and featureEnabled(Features.GPU_RESOURCES) + } private val complyWithConstraintRules: Validator[Constraint] = new Validator[Constraint] { import Constraint.Operator._ diff --git a/src/test/scala/mesosphere/marathon/api/v2/json/AppDefinitionTest.scala b/src/test/scala/mesosphere/marathon/api/v2/json/AppDefinitionTest.scala index 11beab598ce..d1ccb9f2cba 100644 --- a/src/test/scala/mesosphere/marathon/api/v2/json/AppDefinitionTest.scala +++ b/src/test/scala/mesosphere/marathon/api/v2/json/AppDefinitionTest.scala @@ -430,6 +430,13 @@ class AppDefinitionTest extends MarathonSpec with Matchers { ) shouldNotViolate(app, "/", "GPU resources only work with the Mesos containerizer") + + app = correct.copy( + gpus = 1, + container = None + ) + + shouldNotViolate(app, "/", "GPU resources only work with the Mesos containerizer") } test("SerializationRoundtrip empty") { diff --git a/src/test/scala/mesosphere/marathon/core/task/jobs/ExpungeOverdueLostTasksActorTest.scala b/src/test/scala/mesosphere/marathon/core/task/jobs/ExpungeOverdueLostTasksActorTest.scala index 3bbcefebc28..19b0675c173 100644 --- a/src/test/scala/mesosphere/marathon/core/task/jobs/ExpungeOverdueLostTasksActorTest.scala +++ b/src/test/scala/mesosphere/marathon/core/task/jobs/ExpungeOverdueLostTasksActorTest.scala @@ -62,7 +62,7 @@ class ExpungeOverdueLostTasksActorTest extends MarathonSpec with GivenWhenThen w test("a unreachable task with more then 24 hours with no status update should be killed") { Given("one unreachable, one running tasks") - val running = MarathonTestHelper.minimalRunning("/running1".toPath, since= Timestamp.apply(0)) + val running = MarathonTestHelper.minimalRunning("/running1".toPath, since = Timestamp.apply(0)) val unreachable = MarathonTestHelper.minimalUnreachableTask("/running2".toPath, since = Timestamp.apply(0)) taskTracker.tasksByApp()(any[ExecutionContext]) returns Future.successful(TasksByApp.forTasks(running, unreachable))