diff --git a/orca-api-tck/orca-api-tck.gradle b/orca-api-tck/orca-api-tck.gradle index c883826f94..b5b972f1fb 100644 --- a/orca-api-tck/orca-api-tck.gradle +++ b/orca-api-tck/orca-api-tck.gradle @@ -33,9 +33,7 @@ dependencies { api("org.springframework.boot:spring-boot-starter-test") api("org.springframework.security:spring-security-test") api("org.springframework.security:spring-security-config") - api("com.ninja-squad:springmockk:4.0.2") { - force = true - } + api("com.ninja-squad:springmockk") testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine") } diff --git a/orca-clouddriver/orca-clouddriver.gradle b/orca-clouddriver/orca-clouddriver.gradle index e699186798..9c88194c90 100644 --- a/orca-clouddriver/orca-clouddriver.gradle +++ b/orca-clouddriver/orca-clouddriver.gradle @@ -58,9 +58,7 @@ dependencies { testImplementation("io.spinnaker.fiat:fiat-core:$fiatVersion") testImplementation("dev.minutest:minutest") testImplementation("io.strikt:strikt-core") - testImplementation("io.mockk:mockk:1.13.7") { - force true - } + testImplementation("io.mockk:mockk") testImplementation("ru.lanwen.wiremock:wiremock-junit5:1.3.1") testCompileOnly("org.projectlombok:lombok") diff --git a/orca-plugins-test/orca-plugins-test.gradle b/orca-plugins-test/orca-plugins-test.gradle index d11ace13f6..9fc7f3efd5 100644 --- a/orca-plugins-test/orca-plugins-test.gradle +++ b/orca-plugins-test/orca-plugins-test.gradle @@ -18,9 +18,7 @@ apply from: "$rootDir/gradle/kotlin.gradle" dependencies { implementation(project(":orca-api")) - api("com.ninja-squad:springmockk:4.0.2") { - force = true - } + api("com.ninja-squad:springmockk") testImplementation(project(":orca-web")) testImplementation(project(":orca-queue")) testImplementation(project(":orca-clouddriver")) diff --git a/orca-queue/src/test/kotlin/com/netflix/spinnaker/orca/q/handler/AbortStageHandlerTest.kt b/orca-queue/src/test/kotlin/com/netflix/spinnaker/orca/q/handler/AbortStageHandlerTest.kt index 0a2e4d4f93..34aba602ef 100644 --- a/orca-queue/src/test/kotlin/com/netflix/spinnaker/orca/q/handler/AbortStageHandlerTest.kt +++ b/orca-queue/src/test/kotlin/com/netflix/spinnaker/orca/q/handler/AbortStageHandlerTest.kt @@ -31,8 +31,14 @@ import com.netflix.spinnaker.orca.q.CompleteExecution import com.netflix.spinnaker.orca.q.CompleteStage import com.netflix.spinnaker.q.Queue import com.netflix.spinnaker.time.fixedClock -import com.nhaarman.mockito_kotlin.* -import com.nhaarman.mockito_kotlin.verifyZeroInteractions +import com.nhaarman.mockito_kotlin.any +import com.nhaarman.mockito_kotlin.check +import com.nhaarman.mockito_kotlin.doReturn +import com.nhaarman.mockito_kotlin.mock +import com.nhaarman.mockito_kotlin.never +import com.nhaarman.mockito_kotlin.reset +import com.nhaarman.mockito_kotlin.verify +import com.nhaarman.mockito_kotlin.whenever import org.assertj.core.api.Assertions.assertThat import org.jetbrains.spek.api.dsl.describe import org.jetbrains.spek.api.dsl.given @@ -40,6 +46,7 @@ import org.jetbrains.spek.api.dsl.it import org.jetbrains.spek.api.dsl.on import org.jetbrains.spek.api.lifecycle.CachingMode.GROUP import org.jetbrains.spek.subject.SubjectSpek +import org.mockito.Mockito.verifyNoInteractions import org.springframework.context.ApplicationEventPublisher object AbortStageHandlerTest : SubjectSpek({ @@ -81,8 +88,8 @@ object AbortStageHandlerTest : SubjectSpek({ } it("does nothing at all") { - verifyNoMoreInteractions(queue) - verifyNoMoreInteractions(publisher) + verifyNoInteractions(queue) + verifyNoInteractions(publisher) verify(repository, never()).storeStage(any()) } } diff --git a/orca-queue/src/test/kotlin/com/netflix/spinnaker/orca/q/handler/CancelExecutionHandlerTest.kt b/orca-queue/src/test/kotlin/com/netflix/spinnaker/orca/q/handler/CancelExecutionHandlerTest.kt index a78b40424d..323d615a53 100644 --- a/orca-queue/src/test/kotlin/com/netflix/spinnaker/orca/q/handler/CancelExecutionHandlerTest.kt +++ b/orca-queue/src/test/kotlin/com/netflix/spinnaker/orca/q/handler/CancelExecutionHandlerTest.kt @@ -16,7 +16,9 @@ package com.netflix.spinnaker.orca.q.handler -import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus.* +import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus.CANCELED +import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus.PAUSED +import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus.RUNNING import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionType.PIPELINE import com.netflix.spinnaker.orca.api.test.pipeline import com.netflix.spinnaker.orca.api.test.stage diff --git a/orca-queue/src/test/kotlin/com/netflix/spinnaker/orca/q/handler/CancelStageHandlerTest.kt b/orca-queue/src/test/kotlin/com/netflix/spinnaker/orca/q/handler/CancelStageHandlerTest.kt index 7b042fc037..59ddf640e4 100644 --- a/orca-queue/src/test/kotlin/com/netflix/spinnaker/orca/q/handler/CancelStageHandlerTest.kt +++ b/orca-queue/src/test/kotlin/com/netflix/spinnaker/orca/q/handler/CancelStageHandlerTest.kt @@ -21,7 +21,10 @@ import com.netflix.spinnaker.orca.DefaultStageResolver import com.netflix.spinnaker.orca.TaskResolver import com.netflix.spinnaker.orca.api.pipeline.CancellableStage import com.netflix.spinnaker.orca.api.pipeline.graph.StageDefinitionBuilder -import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus.* +import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus.CANCELED +import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus.NOT_STARTED +import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus.SUCCEEDED +import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus.TERMINAL import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionType.PIPELINE import com.netflix.spinnaker.orca.api.test.pipeline import com.netflix.spinnaker.orca.api.test.stage @@ -33,12 +36,19 @@ import com.netflix.spinnaker.orca.q.StageDefinitionBuildersProvider import com.netflix.spinnaker.orca.q.TasksProvider import com.netflix.spinnaker.orca.q.singleTaskStage import com.netflix.spinnaker.q.Queue -import com.nhaarman.mockito_kotlin.* +import com.nhaarman.mockito_kotlin.any +import com.nhaarman.mockito_kotlin.doReturn +import com.nhaarman.mockito_kotlin.mock +import com.nhaarman.mockito_kotlin.never +import com.nhaarman.mockito_kotlin.reset +import com.nhaarman.mockito_kotlin.verify +import com.nhaarman.mockito_kotlin.whenever import org.jetbrains.spek.api.dsl.context import org.jetbrains.spek.api.dsl.describe import org.jetbrains.spek.api.dsl.it import org.jetbrains.spek.api.lifecycle.CachingMode.GROUP import org.jetbrains.spek.subject.SubjectSpek +import org.mockito.Mockito.verifyNoInteractions object CancelStageHandlerTest : SubjectSpek({ val queue: Queue = mock() @@ -121,7 +131,7 @@ object CancelStageHandlerTest : SubjectSpek({ } it("should not push any messages to the queue") { - verifyNoMoreInteractions(queue) + verifyNoInteractions(queue) } } } @@ -150,7 +160,7 @@ object CancelStageHandlerTest : SubjectSpek({ } it("should not push any messages to the queue") { - verifyNoMoreInteractions(queue) + verifyNoInteractions(queue) } } } diff --git a/orca-queue/src/test/kotlin/com/netflix/spinnaker/orca/q/handler/CompleteExecutionHandlerTest.kt b/orca-queue/src/test/kotlin/com/netflix/spinnaker/orca/q/handler/CompleteExecutionHandlerTest.kt index 7065330ae2..2cce0cca9e 100644 --- a/orca-queue/src/test/kotlin/com/netflix/spinnaker/orca/q/handler/CompleteExecutionHandlerTest.kt +++ b/orca-queue/src/test/kotlin/com/netflix/spinnaker/orca/q/handler/CompleteExecutionHandlerTest.kt @@ -17,7 +17,14 @@ package com.netflix.spinnaker.orca.q.handler import com.netflix.spectator.api.NoopRegistry -import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus.* +import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus.CANCELED +import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus.FAILED_CONTINUE +import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus.NOT_STARTED +import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus.RUNNING +import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus.SKIPPED +import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus.STOPPED +import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus.SUCCEEDED +import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus.TERMINAL import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionType.PIPELINE import com.netflix.spinnaker.orca.api.test.pipeline import com.netflix.spinnaker.orca.api.test.stage @@ -27,17 +34,28 @@ import com.netflix.spinnaker.orca.q.CancelStage import com.netflix.spinnaker.orca.q.CompleteExecution import com.netflix.spinnaker.orca.q.StartWaitingExecutions import com.netflix.spinnaker.q.Queue -import com.nhaarman.mockito_kotlin.* +import com.nhaarman.mockito_kotlin.any +import com.nhaarman.mockito_kotlin.check +import com.nhaarman.mockito_kotlin.doReturn +import com.nhaarman.mockito_kotlin.eq +import com.nhaarman.mockito_kotlin.mock +import com.nhaarman.mockito_kotlin.never +import com.nhaarman.mockito_kotlin.reset +import com.nhaarman.mockito_kotlin.verify +import com.nhaarman.mockito_kotlin.verifyNoMoreInteractions +import com.nhaarman.mockito_kotlin.whenever +import com.nhaarman.mockito_kotlin.times +import java.time.Duration +import java.util.UUID +import kotlin.collections.set import org.assertj.core.api.Assertions.assertThat import org.jetbrains.spek.api.dsl.describe import org.jetbrains.spek.api.dsl.it import org.jetbrains.spek.api.dsl.on import org.jetbrains.spek.api.lifecycle.CachingMode.GROUP import org.jetbrains.spek.subject.SubjectSpek +import org.mockito.Mockito.verifyNoInteractions import org.springframework.context.ApplicationEventPublisher -import java.time.Duration -import java.util.* -import kotlin.collections.set object CompleteExecutionHandlerTest : SubjectSpek({ @@ -91,7 +109,7 @@ object CompleteExecutionHandlerTest : SubjectSpek({ } it("does not queue any other commands") { - verifyNoMoreInteractions(queue) + verifyNoInteractions(queue) } } @@ -262,7 +280,7 @@ object CompleteExecutionHandlerTest : SubjectSpek({ } it("does not queue any other commands") { - verifyNoMoreInteractions(queue) + verifyNoInteractions(queue) } } @@ -311,7 +329,7 @@ object CompleteExecutionHandlerTest : SubjectSpek({ } it("does not queue any other commands") { - verifyNoMoreInteractions(queue) + verifyNoInteractions(queue) } } @@ -356,7 +374,7 @@ object CompleteExecutionHandlerTest : SubjectSpek({ } it("publishes no events") { - verifyNoMoreInteractions(publisher) + verifyNoInteractions(publisher) } it("re-queues the message") { diff --git a/orca-queue/src/test/kotlin/com/netflix/spinnaker/orca/q/handler/CompleteStageHandlerTest.kt b/orca-queue/src/test/kotlin/com/netflix/spinnaker/orca/q/handler/CompleteStageHandlerTest.kt index 8af6fb1d39..c2078de3e3 100644 --- a/orca-queue/src/test/kotlin/com/netflix/spinnaker/orca/q/handler/CompleteStageHandlerTest.kt +++ b/orca-queue/src/test/kotlin/com/netflix/spinnaker/orca/q/handler/CompleteStageHandlerTest.kt @@ -25,7 +25,14 @@ import com.netflix.spinnaker.orca.api.pipeline.SyntheticStageOwner.STAGE_BEFORE import com.netflix.spinnaker.orca.api.pipeline.graph.StageDefinitionBuilder import com.netflix.spinnaker.orca.api.pipeline.graph.StageGraphBuilder import com.netflix.spinnaker.orca.api.pipeline.graph.TaskNode -import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus.* +import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus.CANCELED +import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus.FAILED_CONTINUE +import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus.NOT_STARTED +import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus.RUNNING +import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus.SKIPPED +import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus.STOPPED +import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus.SUCCEEDED +import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus.TERMINAL import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionType.PIPELINE import com.netflix.spinnaker.orca.api.pipeline.models.StageExecution import com.netflix.spinnaker.orca.api.test.pipeline @@ -39,20 +46,55 @@ import com.netflix.spinnaker.orca.pipeline.expressions.PipelineExpressionEvaluat import com.netflix.spinnaker.orca.pipeline.persistence.ExecutionRepository import com.netflix.spinnaker.orca.pipeline.util.ContextParameterProcessor import com.netflix.spinnaker.orca.pipeline.util.StageNavigator -import com.netflix.spinnaker.orca.q.* +import com.netflix.spinnaker.orca.q.CancelStage +import com.netflix.spinnaker.orca.q.CompleteExecution +import com.netflix.spinnaker.orca.q.CompleteStage +import com.netflix.spinnaker.orca.q.ContinueParentStage +import com.netflix.spinnaker.orca.q.DummyTask +import com.netflix.spinnaker.orca.q.RunTask +import com.netflix.spinnaker.orca.q.StageDefinitionBuildersProvider +import com.netflix.spinnaker.orca.q.StartStage +import com.netflix.spinnaker.orca.q.buildAfterStages +import com.netflix.spinnaker.orca.q.buildBeforeStages +import com.netflix.spinnaker.orca.q.buildFailureStages +import com.netflix.spinnaker.orca.q.buildTasks +import com.netflix.spinnaker.orca.q.get +import com.netflix.spinnaker.orca.q.multiTaskStage +import com.netflix.spinnaker.orca.q.singleTaskStage +import com.netflix.spinnaker.orca.q.stageWithParallelBranches +import com.netflix.spinnaker.orca.q.stageWithSyntheticAfter +import com.netflix.spinnaker.orca.q.stageWithSyntheticBefore +import com.netflix.spinnaker.orca.q.stageWithSyntheticOnFailure import com.netflix.spinnaker.q.Message import com.netflix.spinnaker.q.Queue import com.netflix.spinnaker.spek.and import com.netflix.spinnaker.spek.but import com.netflix.spinnaker.time.fixedClock -import com.nhaarman.mockito_kotlin.* +import com.nhaarman.mockito_kotlin.any +import com.nhaarman.mockito_kotlin.argumentCaptor +import com.nhaarman.mockito_kotlin.atLeastOnce +import com.nhaarman.mockito_kotlin.check +import com.nhaarman.mockito_kotlin.doReturn +import com.nhaarman.mockito_kotlin.isA +import com.nhaarman.mockito_kotlin.mock +import com.nhaarman.mockito_kotlin.never +import com.nhaarman.mockito_kotlin.reset +import com.nhaarman.mockito_kotlin.spy +import com.nhaarman.mockito_kotlin.times +import com.nhaarman.mockito_kotlin.verify +import com.nhaarman.mockito_kotlin.whenever +import java.time.Duration.ZERO import org.assertj.core.api.Assertions.assertThat import org.assertj.core.api.Assertions.fail -import org.jetbrains.spek.api.dsl.* +import org.jetbrains.spek.api.dsl.context +import org.jetbrains.spek.api.dsl.describe +import org.jetbrains.spek.api.dsl.given +import org.jetbrains.spek.api.dsl.it +import org.jetbrains.spek.api.dsl.on import org.jetbrains.spek.api.lifecycle.CachingMode.GROUP import org.jetbrains.spek.subject.SubjectSpek +import org.mockito.Mockito.verifyNoInteractions import org.springframework.context.ApplicationEventPublisher -import java.time.Duration.ZERO object CompleteStageHandlerTest : SubjectSpek({ @@ -172,8 +214,8 @@ object CompleteStageHandlerTest : SubjectSpek({ it("ignores the message") { verify(repository, never()).storeStage(any()) - verifyNoMoreInteractions(queue) - verifyNoMoreInteractions(publisher) + verifyNoInteractions(queue) + verifyNoInteractions(publisher) } } diff --git a/orca-queue/src/test/kotlin/com/netflix/spinnaker/orca/q/handler/CompleteTaskHandlerTest.kt b/orca-queue/src/test/kotlin/com/netflix/spinnaker/orca/q/handler/CompleteTaskHandlerTest.kt index 7aca658801..b021997d4b 100644 --- a/orca-queue/src/test/kotlin/com/netflix/spinnaker/orca/q/handler/CompleteTaskHandlerTest.kt +++ b/orca-queue/src/test/kotlin/com/netflix/spinnaker/orca/q/handler/CompleteTaskHandlerTest.kt @@ -19,7 +19,14 @@ package com.netflix.spinnaker.orca.q.handler import com.netflix.spectator.api.NoopRegistry import com.netflix.spinnaker.orca.DefaultStageResolver import com.netflix.spinnaker.orca.NoOpTaskImplementationResolver -import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus.* +import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus.CANCELED +import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus.FAILED_CONTINUE +import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus.NOT_STARTED +import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus.REDIRECT +import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus.SKIPPED +import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus.STOPPED +import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus.SUCCEEDED +import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus.TERMINAL import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionType.PIPELINE import com.netflix.spinnaker.orca.api.pipeline.models.TaskExecution import com.netflix.spinnaker.orca.api.test.pipeline @@ -29,17 +36,35 @@ import com.netflix.spinnaker.orca.pipeline.DefaultStageDefinitionBuilderFactory import com.netflix.spinnaker.orca.pipeline.model.TaskExecutionImpl import com.netflix.spinnaker.orca.pipeline.persistence.ExecutionRepository import com.netflix.spinnaker.orca.pipeline.util.ContextParameterProcessor -import com.netflix.spinnaker.orca.q.* +import com.netflix.spinnaker.orca.q.CompleteStage +import com.netflix.spinnaker.orca.q.CompleteTask +import com.netflix.spinnaker.orca.q.RunTask +import com.netflix.spinnaker.orca.q.SkipStage +import com.netflix.spinnaker.orca.q.StageDefinitionBuildersProvider +import com.netflix.spinnaker.orca.q.StartTask +import com.netflix.spinnaker.orca.q.buildTasks +import com.netflix.spinnaker.orca.q.get +import com.netflix.spinnaker.orca.q.multiTaskStage +import com.netflix.spinnaker.orca.q.rollingPushStage +import com.netflix.spinnaker.orca.q.singleTaskStage import com.netflix.spinnaker.q.Queue import com.netflix.spinnaker.spek.and import com.netflix.spinnaker.time.fixedClock -import com.nhaarman.mockito_kotlin.* +import com.nhaarman.mockito_kotlin.any +import com.nhaarman.mockito_kotlin.check +import com.nhaarman.mockito_kotlin.doReturn +import com.nhaarman.mockito_kotlin.mock +import com.nhaarman.mockito_kotlin.never +import com.nhaarman.mockito_kotlin.reset +import com.nhaarman.mockito_kotlin.verify +import com.nhaarman.mockito_kotlin.whenever import org.assertj.core.api.Assertions.assertThat import org.jetbrains.spek.api.dsl.describe import org.jetbrains.spek.api.dsl.given import org.jetbrains.spek.api.dsl.it import org.jetbrains.spek.api.lifecycle.CachingMode.GROUP import org.jetbrains.spek.subject.SubjectSpek +import org.mockito.Mockito.verifyNoInteractions import org.springframework.context.ApplicationEventPublisher object CompleteTaskHandlerTest : SubjectSpek({ @@ -226,7 +251,7 @@ object CompleteTaskHandlerTest : SubjectSpek({ } it("does not publish an event") { - verifyNoMoreInteractions(publisher) + verifyNoInteractions(publisher) } } } diff --git a/orca-queue/src/test/kotlin/com/netflix/spinnaker/orca/q/handler/ConfigurationErrorHandlerTest.kt b/orca-queue/src/test/kotlin/com/netflix/spinnaker/orca/q/handler/ConfigurationErrorHandlerTest.kt index a57fc3e760..91fed9618f 100644 --- a/orca-queue/src/test/kotlin/com/netflix/spinnaker/orca/q/handler/ConfigurationErrorHandlerTest.kt +++ b/orca-queue/src/test/kotlin/com/netflix/spinnaker/orca/q/handler/ConfigurationErrorHandlerTest.kt @@ -19,17 +19,23 @@ package com.netflix.spinnaker.orca.q.handler import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus.TERMINAL import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionType.PIPELINE import com.netflix.spinnaker.orca.pipeline.persistence.ExecutionRepository -import com.netflix.spinnaker.orca.q.* +import com.netflix.spinnaker.orca.q.ConfigurationError +import com.netflix.spinnaker.orca.q.InvalidExecutionId +import com.netflix.spinnaker.orca.q.InvalidStageId +import com.netflix.spinnaker.orca.q.InvalidTask +import com.netflix.spinnaker.orca.q.InvalidTaskId +import com.netflix.spinnaker.orca.q.InvalidTaskType +import com.netflix.spinnaker.orca.q.NoDownstreamTasks import com.netflix.spinnaker.q.Queue import com.nhaarman.mockito_kotlin.mock import com.nhaarman.mockito_kotlin.reset import com.nhaarman.mockito_kotlin.verify -import com.nhaarman.mockito_kotlin.verifyNoMoreInteractions import org.jetbrains.spek.api.dsl.describe import org.jetbrains.spek.api.dsl.it import org.jetbrains.spek.api.dsl.on import org.jetbrains.spek.api.lifecycle.CachingMode.GROUP import org.jetbrains.spek.subject.SubjectSpek +import org.mockito.Mockito.verifyNoInteractions object ConfigurationErrorHandlerTest : SubjectSpek({ @@ -51,11 +57,11 @@ object ConfigurationErrorHandlerTest : SubjectSpek({ } it("does not try to update the execution status") { - verifyNoMoreInteractions(repository) + verifyNoInteractions(repository) } it("does not push any messages to the queue") { - verifyNoMoreInteractions(queue) + verifyNoInteractions(queue) } } } @@ -78,7 +84,7 @@ object ConfigurationErrorHandlerTest : SubjectSpek({ } it("does not push any messages to the queue") { - verifyNoMoreInteractions(queue) + verifyNoInteractions(queue) } } } diff --git a/orca-queue/src/test/kotlin/com/netflix/spinnaker/orca/q/handler/ContinueParentStageHandlerTest.kt b/orca-queue/src/test/kotlin/com/netflix/spinnaker/orca/q/handler/ContinueParentStageHandlerTest.kt index 597f20fcb3..270ef140f1 100644 --- a/orca-queue/src/test/kotlin/com/netflix/spinnaker/orca/q/handler/ContinueParentStageHandlerTest.kt +++ b/orca-queue/src/test/kotlin/com/netflix/spinnaker/orca/q/handler/ContinueParentStageHandlerTest.kt @@ -19,23 +19,39 @@ package com.netflix.spinnaker.orca.q.handler import com.netflix.spinnaker.orca.NoOpTaskImplementationResolver import com.netflix.spinnaker.orca.api.pipeline.SyntheticStageOwner.STAGE_AFTER import com.netflix.spinnaker.orca.api.pipeline.SyntheticStageOwner.STAGE_BEFORE -import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus.* +import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus.FAILED_CONTINUE +import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus.RUNNING +import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus.SUCCEEDED +import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus.TERMINAL import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionType.PIPELINE import com.netflix.spinnaker.orca.api.test.pipeline import com.netflix.spinnaker.orca.api.test.stage import com.netflix.spinnaker.orca.ext.beforeStages import com.netflix.spinnaker.orca.pipeline.persistence.ExecutionRepository -import com.netflix.spinnaker.orca.q.* +import com.netflix.spinnaker.orca.q.CompleteStage +import com.netflix.spinnaker.orca.q.ContinueParentStage +import com.netflix.spinnaker.orca.q.StartTask +import com.netflix.spinnaker.orca.q.buildAfterStages +import com.netflix.spinnaker.orca.q.buildBeforeStages +import com.netflix.spinnaker.orca.q.buildTasks +import com.netflix.spinnaker.orca.q.stageWithParallelAfter +import com.netflix.spinnaker.orca.q.stageWithSyntheticBefore +import com.netflix.spinnaker.orca.q.stageWithSyntheticBeforeAndNoTasks import com.netflix.spinnaker.q.Queue import com.netflix.spinnaker.spek.and -import com.nhaarman.mockito_kotlin.* +import com.nhaarman.mockito_kotlin.doReturn +import com.nhaarman.mockito_kotlin.mock +import com.nhaarman.mockito_kotlin.reset +import com.nhaarman.mockito_kotlin.verify +import com.nhaarman.mockito_kotlin.whenever +import java.time.Duration import org.jetbrains.spek.api.dsl.describe import org.jetbrains.spek.api.dsl.given import org.jetbrains.spek.api.dsl.it import org.jetbrains.spek.api.dsl.on import org.jetbrains.spek.api.lifecycle.CachingMode import org.jetbrains.spek.subject.SubjectSpek -import java.time.Duration +import org.mockito.Mockito.verifyNoInteractions object ContinueParentStageHandlerTest : SubjectSpek({ @@ -105,7 +121,7 @@ object ContinueParentStageHandlerTest : SubjectSpek( } it("does not re-queue the message") { - verifyNoMoreInteractions(queue) + verifyNoInteractions(queue) } } @@ -154,7 +170,7 @@ object ContinueParentStageHandlerTest : SubjectSpek( } it("ignores the message") { - verifyNoMoreInteractions(queue) + verifyNoInteractions(queue) } } } diff --git a/orca-queue/src/test/kotlin/com/netflix/spinnaker/orca/q/handler/DeadMessageHandlerTest.kt b/orca-queue/src/test/kotlin/com/netflix/spinnaker/orca/q/handler/DeadMessageHandlerTest.kt index e2667b82ba..43cf1a994f 100644 --- a/orca-queue/src/test/kotlin/com/netflix/spinnaker/orca/q/handler/DeadMessageHandlerTest.kt +++ b/orca-queue/src/test/kotlin/com/netflix/spinnaker/orca/q/handler/DeadMessageHandlerTest.kt @@ -18,17 +18,23 @@ package com.netflix.spinnaker.orca.q.handler import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus.TERMINAL import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionType.PIPELINE -import com.netflix.spinnaker.orca.q.* +import com.netflix.spinnaker.orca.q.AbortStage +import com.netflix.spinnaker.orca.q.CompleteExecution +import com.netflix.spinnaker.orca.q.CompleteTask +import com.netflix.spinnaker.orca.q.DummyTask +import com.netflix.spinnaker.orca.q.RunTask +import com.netflix.spinnaker.orca.q.StartExecution +import com.netflix.spinnaker.orca.q.StartStage import com.netflix.spinnaker.q.Queue import com.nhaarman.mockito_kotlin.mock import com.nhaarman.mockito_kotlin.reset import com.nhaarman.mockito_kotlin.verify -import com.nhaarman.mockito_kotlin.verifyNoMoreInteractions import org.jetbrains.spek.api.dsl.describe import org.jetbrains.spek.api.dsl.it import org.jetbrains.spek.api.dsl.on import org.jetbrains.spek.api.lifecycle.CachingMode.GROUP import org.jetbrains.spek.subject.SubjectSpek +import org.mockito.Mockito.verifyNoInteractions object DeadMessageHandlerTest : SubjectSpek({ @@ -94,7 +100,7 @@ object DeadMessageHandlerTest : SubjectSpek({ } it("does nothing") { - verifyNoMoreInteractions(queue) + verifyNoInteractions(queue) } } }) diff --git a/orca-queue/src/test/kotlin/com/netflix/spinnaker/orca/q/handler/PauseStageHandlerTest.kt b/orca-queue/src/test/kotlin/com/netflix/spinnaker/orca/q/handler/PauseStageHandlerTest.kt index a4fdb2d109..4eb82d581a 100644 --- a/orca-queue/src/test/kotlin/com/netflix/spinnaker/orca/q/handler/PauseStageHandlerTest.kt +++ b/orca-queue/src/test/kotlin/com/netflix/spinnaker/orca/q/handler/PauseStageHandlerTest.kt @@ -26,13 +26,20 @@ import com.netflix.spinnaker.orca.q.buildBeforeStages import com.netflix.spinnaker.orca.q.singleTaskStage import com.netflix.spinnaker.orca.q.stageWithSyntheticBefore import com.netflix.spinnaker.q.Queue -import com.nhaarman.mockito_kotlin.* +import com.nhaarman.mockito_kotlin.check +import com.nhaarman.mockito_kotlin.doReturn +import com.nhaarman.mockito_kotlin.mock +import com.nhaarman.mockito_kotlin.reset +import com.nhaarman.mockito_kotlin.verify +import com.nhaarman.mockito_kotlin.verifyNoMoreInteractions +import com.nhaarman.mockito_kotlin.whenever import org.assertj.core.api.Assertions.assertThat import org.jetbrains.spek.api.dsl.context import org.jetbrains.spek.api.dsl.describe import org.jetbrains.spek.api.dsl.it import org.jetbrains.spek.api.lifecycle.CachingMode.GROUP import org.jetbrains.spek.subject.SubjectSpek +import org.mockito.Mockito.verifyNoInteractions object PauseStageHandlerTest : SubjectSpek({ @@ -80,7 +87,7 @@ object PauseStageHandlerTest : SubjectSpek({ } it("does not take any further action") { - verifyNoMoreInteractions(queue) + verifyNoInteractions(queue) } } diff --git a/orca-queue/src/test/kotlin/com/netflix/spinnaker/orca/q/handler/SkipStageHandlerTest.kt b/orca-queue/src/test/kotlin/com/netflix/spinnaker/orca/q/handler/SkipStageHandlerTest.kt index 9d8ba338f8..767ff36ec0 100644 --- a/orca-queue/src/test/kotlin/com/netflix/spinnaker/orca/q/handler/SkipStageHandlerTest.kt +++ b/orca-queue/src/test/kotlin/com/netflix/spinnaker/orca/q/handler/SkipStageHandlerTest.kt @@ -16,16 +16,33 @@ package com.netflix.spinnaker.orca.q.handler -import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus.* +import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus.FAILED_CONTINUE +import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus.RUNNING +import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus.SKIPPED +import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus.SUCCEEDED +import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus.TERMINAL import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionType.PIPELINE import com.netflix.spinnaker.orca.api.test.pipeline import com.netflix.spinnaker.orca.api.test.stage import com.netflix.spinnaker.orca.events.StageComplete import com.netflix.spinnaker.orca.pipeline.persistence.ExecutionRepository -import com.netflix.spinnaker.orca.q.* +import com.netflix.spinnaker.orca.q.CompleteExecution +import com.netflix.spinnaker.orca.q.RunTask +import com.netflix.spinnaker.orca.q.SkipStage +import com.netflix.spinnaker.orca.q.StartStage +import com.netflix.spinnaker.orca.q.get import com.netflix.spinnaker.q.Queue import com.netflix.spinnaker.time.fixedClock -import com.nhaarman.mockito_kotlin.* +import com.nhaarman.mockito_kotlin.any +import com.nhaarman.mockito_kotlin.argumentCaptor +import com.nhaarman.mockito_kotlin.check +import com.nhaarman.mockito_kotlin.doReturn +import com.nhaarman.mockito_kotlin.mock +import com.nhaarman.mockito_kotlin.never +import com.nhaarman.mockito_kotlin.reset +import com.nhaarman.mockito_kotlin.times +import com.nhaarman.mockito_kotlin.verify +import com.nhaarman.mockito_kotlin.whenever import org.assertj.core.api.Assertions.assertThat import org.jetbrains.spek.api.dsl.describe import org.jetbrains.spek.api.dsl.given @@ -33,6 +50,7 @@ import org.jetbrains.spek.api.dsl.it import org.jetbrains.spek.api.dsl.on import org.jetbrains.spek.api.lifecycle.CachingMode.GROUP import org.jetbrains.spek.subject.SubjectSpek +import org.mockito.Mockito.verifyNoInteractions import org.springframework.context.ApplicationEventPublisher object SkipStageHandlerTest : SubjectSpek({ @@ -73,8 +91,8 @@ object SkipStageHandlerTest : SubjectSpek({ it("ignores the message") { verify(repository, never()).storeStage(any()) - verifyNoMoreInteractions(queue) - verifyNoMoreInteractions(publisher) + verifyNoInteractions(queue) + verifyNoInteractions(publisher) } } diff --git a/orca-queue/src/test/kotlin/com/netflix/spinnaker/orca/q/handler/StartStageHandlerTest.kt b/orca-queue/src/test/kotlin/com/netflix/spinnaker/orca/q/handler/StartStageHandlerTest.kt index c0b99ef1be..f56d778690 100644 --- a/orca-queue/src/test/kotlin/com/netflix/spinnaker/orca/q/handler/StartStageHandlerTest.kt +++ b/orca-queue/src/test/kotlin/com/netflix/spinnaker/orca/q/handler/StartStageHandlerTest.kt @@ -23,7 +23,10 @@ import com.netflix.spinnaker.assertj.assertSoftly import com.netflix.spinnaker.orca.DefaultStageResolver import com.netflix.spinnaker.orca.NoOpTaskImplementationResolver import com.netflix.spinnaker.orca.api.pipeline.SyntheticStageOwner.STAGE_BEFORE -import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus.* +import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus.FAILED_CONTINUE +import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus.RUNNING +import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus.SUCCEEDED +import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionStatus.TERMINAL import com.netflix.spinnaker.orca.api.pipeline.models.ExecutionType.PIPELINE import com.netflix.spinnaker.orca.api.pipeline.models.StageExecution import com.netflix.spinnaker.orca.api.pipeline.models.TaskExecution @@ -37,17 +40,58 @@ import com.netflix.spinnaker.orca.pipeline.persistence.ExecutionNotFoundExceptio import com.netflix.spinnaker.orca.pipeline.persistence.ExecutionRepository import com.netflix.spinnaker.orca.pipeline.util.ContextParameterProcessor import com.netflix.spinnaker.orca.pipeline.util.StageNavigator -import com.netflix.spinnaker.orca.q.* +import com.netflix.spinnaker.orca.q.CompleteExecution +import com.netflix.spinnaker.orca.q.CompleteStage +import com.netflix.spinnaker.orca.q.DummyTask +import com.netflix.spinnaker.orca.q.InvalidExecutionId +import com.netflix.spinnaker.orca.q.InvalidStageId +import com.netflix.spinnaker.orca.q.SkipStage +import com.netflix.spinnaker.orca.q.StageDefinitionBuildersProvider +import com.netflix.spinnaker.orca.q.StartStage +import com.netflix.spinnaker.orca.q.StartTask +import com.netflix.spinnaker.orca.q.buildBeforeStages +import com.netflix.spinnaker.orca.q.buildTasks +import com.netflix.spinnaker.orca.q.failPlanningStage +import com.netflix.spinnaker.orca.q.get +import com.netflix.spinnaker.orca.q.multiTaskStage +import com.netflix.spinnaker.orca.q.rollingPushStage +import com.netflix.spinnaker.orca.q.singleTaskStage +import com.netflix.spinnaker.orca.q.stageWithParallelBranches +import com.netflix.spinnaker.orca.q.stageWithSyntheticAfter +import com.netflix.spinnaker.orca.q.stageWithSyntheticAfterAndNoTasks +import com.netflix.spinnaker.orca.q.stageWithSyntheticBefore +import com.netflix.spinnaker.orca.q.webhookStage +import com.netflix.spinnaker.orca.q.zeroTaskStage import com.netflix.spinnaker.q.Queue import com.netflix.spinnaker.spek.and import com.netflix.spinnaker.time.fixedClock -import com.nhaarman.mockito_kotlin.* +import com.nhaarman.mockito_kotlin.any +import com.nhaarman.mockito_kotlin.anyOrNull +import com.nhaarman.mockito_kotlin.atLeastOnce +import com.nhaarman.mockito_kotlin.argumentCaptor +import com.nhaarman.mockito_kotlin.check +import com.nhaarman.mockito_kotlin.doReturn +import com.nhaarman.mockito_kotlin.doThrow +import com.nhaarman.mockito_kotlin.isA +import com.nhaarman.mockito_kotlin.mock +import com.nhaarman.mockito_kotlin.never +import com.nhaarman.mockito_kotlin.reset +import com.nhaarman.mockito_kotlin.times +import com.nhaarman.mockito_kotlin.spy +import com.nhaarman.mockito_kotlin.verify +import com.nhaarman.mockito_kotlin.whenever +import com.nhaarman.mockito_kotlin.verifyNoMoreInteractions +import java.time.Duration import org.assertj.core.api.Assertions.assertThat -import org.jetbrains.spek.api.dsl.* +import org.jetbrains.spek.api.dsl.context +import org.jetbrains.spek.api.dsl.describe +import org.jetbrains.spek.api.dsl.given +import org.jetbrains.spek.api.dsl.it +import org.jetbrains.spek.api.dsl.on import org.jetbrains.spek.api.lifecycle.CachingMode.GROUP import org.jetbrains.spek.subject.SubjectSpek +import org.mockito.Mockito.verifyNoInteractions import org.springframework.context.ApplicationEventPublisher -import java.time.Duration object StartStageHandlerTest : SubjectSpek({ @@ -429,7 +473,7 @@ object StartStageHandlerTest : SubjectSpek({ } it("does not publish an event") { - verifyNoMoreInteractions(publisher) + verifyNoInteractions(publisher) } it("re-queues the message with a delay") { @@ -473,7 +517,7 @@ object StartStageHandlerTest : SubjectSpek({ } it("publishes no events") { - verifyNoMoreInteractions(publisher) + verifyNoInteractions(publisher) } it("completes the execution") { @@ -497,11 +541,11 @@ object StartStageHandlerTest : SubjectSpek({ } it("does not queue any messages") { - verifyNoMoreInteractions(queue) + verifyNoInteractions(queue) } it("does not publish any events") { - verifyNoMoreInteractions(publisher) + verifyNoInteractions(publisher) } } } diff --git a/orca-queue/src/test/kotlin/com/netflix/spinnaker/orca/q/handler/StartWaitingExecutionsHandlerTest.kt b/orca-queue/src/test/kotlin/com/netflix/spinnaker/orca/q/handler/StartWaitingExecutionsHandlerTest.kt index f49161044b..c6046facd5 100644 --- a/orca-queue/src/test/kotlin/com/netflix/spinnaker/orca/q/handler/StartWaitingExecutionsHandlerTest.kt +++ b/orca-queue/src/test/kotlin/com/netflix/spinnaker/orca/q/handler/StartWaitingExecutionsHandlerTest.kt @@ -24,16 +24,28 @@ import com.netflix.spinnaker.orca.q.StartWaitingExecutions import com.netflix.spinnaker.orca.q.pending.PendingExecutionService import com.netflix.spinnaker.q.Message import com.netflix.spinnaker.q.Queue -import com.nhaarman.mockito_kotlin.* +import com.nhaarman.mockito_kotlin.argumentCaptor +import com.nhaarman.mockito_kotlin.doReturn +import com.nhaarman.mockito_kotlin.eq +import com.nhaarman.mockito_kotlin.isA +import com.nhaarman.mockito_kotlin.mock +import com.nhaarman.mockito_kotlin.never +import com.nhaarman.mockito_kotlin.reset +import com.nhaarman.mockito_kotlin.times +import com.nhaarman.mockito_kotlin.verify +import com.nhaarman.mockito_kotlin.whenever +import com.nhaarman.mockito_kotlin.verifyNoMoreInteractions +import java.time.Instant.now +import java.util.Random +import java.util.UUID +import kotlin.math.absoluteValue import org.jetbrains.spek.api.dsl.describe import org.jetbrains.spek.api.dsl.given import org.jetbrains.spek.api.dsl.it import org.jetbrains.spek.api.dsl.on import org.jetbrains.spek.api.lifecycle.CachingMode.GROUP import org.jetbrains.spek.subject.SubjectSpek -import java.time.Instant.now -import java.util.* -import kotlin.math.absoluteValue +import org.mockito.Mockito.verifyNoInteractions object StartWaitingExecutionsHandlerTest : SubjectSpek({ @@ -64,7 +76,7 @@ object StartWaitingExecutionsHandlerTest : SubjectSpek