chore(damn): detekt, build, tests, formatting
fixed detekt issues where possible. fixed disttar failing build because tools is added twice in the server module. added workflowId where required. fixed some tests not being recognized because of runBlocking without explicit return type. formatting + imports.
This commit is contained in:
@@ -22,12 +22,13 @@ class OrchestrationReducerTest {
|
||||
private val sessionId = SessionId("s1")
|
||||
private val stageId = StageId("stage-1")
|
||||
private val state = OrchestrationState(stageId)
|
||||
private val workflowId = "workflow-test"
|
||||
|
||||
@Test
|
||||
fun `WorkflowStartedEvent sets status to RUNNING`() {
|
||||
val state = reducer.reduce(
|
||||
state,
|
||||
stored(payload = WorkflowStartedEvent(sessionId, stageId)),
|
||||
stored(payload = WorkflowStartedEvent(sessionId, workflowId, stageId)),
|
||||
)
|
||||
assertEquals(OrchestrationStatus.RUNNING, state.status)
|
||||
assertEquals(stageId, state.currentStageId)
|
||||
@@ -37,7 +38,7 @@ class OrchestrationReducerTest {
|
||||
fun `WorkflowFailedEvent sets status to FAILED and failure reason`() {
|
||||
val started = reducer.reduce(
|
||||
state,
|
||||
stored(payload = WorkflowStartedEvent(sessionId, stageId)),
|
||||
stored(payload = WorkflowStartedEvent(sessionId, workflowId, stageId)),
|
||||
)
|
||||
|
||||
val failed = reducer.reduce(
|
||||
@@ -52,12 +53,12 @@ class OrchestrationReducerTest {
|
||||
fun `WorkflowCompletedEvent sets status to COMPLETED`() {
|
||||
val started = reducer.reduce(
|
||||
state,
|
||||
stored(payload = WorkflowStartedEvent(sessionId, stageId)),
|
||||
stored(payload = WorkflowStartedEvent(sessionId, workflowId, stageId)),
|
||||
)
|
||||
|
||||
val completed = reducer.reduce(
|
||||
started,
|
||||
stored(payload = WorkflowCompletedEvent(sessionId, stageId, 1)),
|
||||
stored(payload = WorkflowCompletedEvent(sessionId, stageId, 1, workflowId)),
|
||||
)
|
||||
assertTrue(completed.failureReason.isNullOrBlank())
|
||||
assertEquals(OrchestrationStatus.COMPLETED, completed.status)
|
||||
@@ -68,7 +69,7 @@ class OrchestrationReducerTest {
|
||||
fun `OrchestrationPausedEvent sets status to PAUSED with reason and pending approval`() {
|
||||
val started = reducer.reduce(
|
||||
state,
|
||||
stored(payload = WorkflowStartedEvent(sessionId, stageId)),
|
||||
stored(payload = WorkflowStartedEvent(sessionId, workflowId, stageId)),
|
||||
)
|
||||
|
||||
val paused = reducer.reduce(
|
||||
@@ -84,7 +85,7 @@ class OrchestrationReducerTest {
|
||||
fun `OrchestrationResumedEvent sets status to RUNNING with null reason and no pending approval`() {
|
||||
val started = reducer.reduce(
|
||||
state,
|
||||
stored(payload = WorkflowStartedEvent(sessionId, stageId)),
|
||||
stored(payload = WorkflowStartedEvent(sessionId, workflowId, stageId)),
|
||||
)
|
||||
|
||||
val paused = reducer.reduce(
|
||||
@@ -105,7 +106,7 @@ class OrchestrationReducerTest {
|
||||
fun `RetryAttemptedEvent sets status to RUNNING with null reason and no pending approval`() {
|
||||
val started = reducer.reduce(
|
||||
state,
|
||||
stored(payload = WorkflowStartedEvent(sessionId, stageId)),
|
||||
stored(payload = WorkflowStartedEvent(sessionId, workflowId, stageId)),
|
||||
)
|
||||
|
||||
val failed = reducer.reduce(
|
||||
@@ -137,10 +138,10 @@ class OrchestrationReducerTest {
|
||||
fun `unrelated event does nothing`() {
|
||||
val started = reducer.reduce(
|
||||
state,
|
||||
stored(payload = WorkflowStartedEvent(sessionId, stageId)),
|
||||
stored(payload = WorkflowStartedEvent(sessionId, workflowId, stageId)),
|
||||
)
|
||||
|
||||
val unrelated = reducer.reduce(started, stored())
|
||||
assertEquals(started, unrelated)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user