Skip to content

Commit

Permalink
Fix scenario status when job manager is down (#2247)
Browse files Browse the repository at this point in the history
  • Loading branch information
dswiecki authored Sep 23, 2021
1 parent e743904 commit 98b00cb
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ class NussknackerAppInitializer(baseUnresolvedConfig: Config) extends LazyLoggin

(route, objectsToClose)
}

def bindHttp(interface: String, port: Int, route: Route)(implicit system: ActorSystem, materializer: Materializer): Future[Http.ServerBinding] = {
Http().bindAndHandle(
handler = route,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ class ManagementActor(managers: ProcessingTypeDataProvider[DeploymentManager],
processState match {
case Some(state) =>
state.version match {
case Some(_) if !state.isDeployed =>
case _ if !state.isDeployed =>
ProcessStatus.simpleErrorShouldBeRunning(action.processVersionId, action.user, processState)
case Some(ver) if ver.versionId != action.processVersionId =>
ProcessStatus.simpleErrorMismatchDeployedVersion(ver.versionId, action.processVersionId, action.user, processState)
Expand All @@ -212,8 +212,7 @@ class ManagementActor(managers: ProcessingTypeDataProvider[DeploymentManager],
case None => //TODO: we should remove Option from ProcessVersion?
ProcessStatus.simpleWarningMissingDeployedVersion(action.processVersionId, action.user, processState)
case _ =>
ProcessStatus.simple(SimpleStateStatus.Error) //Generic
// c error in other cases
ProcessStatus.simple(SimpleStateStatus.Error) //Generic error in other cases
}
case None =>
ProcessStatus.simpleErrorShouldBeRunning(action.processVersionId, action.user, Option.empty)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,19 @@ class ManagementActorSpec extends FunSuite with Matchers with PatientScalaFuture
}
}

test("Should return error state when failed to get state") {
val id = prepareDeployedProcess(processName).futureValue

deploymentManager.withProcessStateVersion(SimpleStateStatus.FailedToGet, Option.empty) {
val state = processService.getProcessState(ProcessIdWithName(id, processName)).futureValue

state.status shouldBe SimpleStateStatus.Error
state.icon shouldBe Some(SimpleProcessStateDefinitionManager.deployFailedIcon)
state.allowedActions shouldBe List(ProcessActionType.Deploy, ProcessActionType.Cancel)
state.description shouldBe Some(SimpleProcessStateDefinitionManager.shouldBeRunningDescription)
}
}

test("Should return not deployed status for process with empty state - not deployed state") {
val id = prepareProcess(processName).futureValue
fetchingProcessRepository.fetchLatestProcessDetailsForProcessId[Unit](id).futureValue.get.lastAction shouldBe None
Expand Down

0 comments on commit 98b00cb

Please sign in to comment.