Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(core/test): fix cardinality issue by replacing Stub to Mock …
…during upgrade to groovy 3.x While upgrading groovy 3.0.10 and spockframework 2.0-groovy-3.0, encountered the following errors in groovy test orca-core module: ``` Stub 'executionRepository' matches the following required interaction: 0 * _ (0 invocations) Remove the cardinality (e.g. '1 *'), or turn the stub into a mock. org.spockframework.runtime.InvalidSpecException: Stub 'executionRepository' matches the following required interaction: 0 * _ (0 invocations) Remove the cardinality (e.g. '1 *'), or turn the stub into a mock. at app//org.spockframework.mock.constraint.TargetConstraint.setInteraction(TargetConstraint.java:57) at app//org.spockframework.mock.runtime.MockInteraction.<init>(MockInteraction.java:53) at app//org.spockframework.mock.runtime.InteractionBuilder.build(InteractionBuilder.java:187) at com.netflix.spinnaker.orca.pipeline.util.ArtifactUtilsSpec.$spock_initializeFields_closure2(ArtifactUtilsSpec.groovy:49) at app//groovy.lang.Closure.call(Closure.java:412) at app//org.spockframework.lang.SpecInternals.createMock(SpecInternals.java:50) at app//org.spockframework.lang.SpecInternals.createMockImpl(SpecInternals.java:302) at app//org.spockframework.lang.SpecInternals.createMockImpl(SpecInternals.java:292) at app//org.spockframework.lang.SpecInternals.StubImpl(SpecInternals.java:137) at app//com.netflix.spinnaker.orca.pipeline.util.ArtifactUtilsSpec.$spock_initializeFields(ArtifactUtilsSpec.groovy:45) ``` ``` ArtifactUtilsSpec > should find artifacts from a specific pipeline FAILED org.spockframework.runtime.InvalidSpecException: Stub 'executionRepositoryStub' matches the following required interaction: 0 * _ (0 invocations) Remove the cardinality (e.g. '1 *'), or turn the stub into a mock. at app//org.spockframework.mock.constraint.TargetConstraint.setInteraction(TargetConstraint.java:57) at app//org.spockframework.mock.runtime.MockInteraction.<init>(MockInteraction.java:53) at app//org.spockframework.mock.runtime.InteractionBuilder.build(InteractionBuilder.java:187) at com.netflix.spinnaker.orca.pipeline.util.ArtifactUtilsSpec.should find artifacts from a specific pipeline_closure25(ArtifactUtilsSpec.groovy:344) at app//groovy.lang.Closure.call(Closure.java:412) at app//org.spockframework.lang.SpecInternals.createMock(SpecInternals.java:50) at app//org.spockframework.lang.SpecInternals.createMockImpl(SpecInternals.java:302) at app//org.spockframework.lang.SpecInternals.createMockImpl(SpecInternals.java:292) at app//org.spockframework.lang.SpecInternals.StubImpl(SpecInternals.java:137) at com.netflix.spinnaker.orca.pipeline.util.ArtifactUtilsSpec.should find artifacts from a specific pipeline(ArtifactUtilsSpec.groovy:339) 1 test completed, 1 failed > Task :orca-core:test FAILED ``` ``` ArtifactUtilsSpec > should find artifacts without a specific stage ref FAILED org.spockframework.runtime.InvalidSpecException: Stub 'executionRepositoryStub' matches the following required interaction: 0 * _ (0 invocations) Remove the cardinality (e.g. '1 *'), or turn the stub into a mock. at app//org.spockframework.mock.constraint.TargetConstraint.setInteraction(TargetConstraint.java:57) at app//org.spockframework.mock.runtime.MockInteraction.<init>(MockInteraction.java:53) at app//org.spockframework.mock.runtime.InteractionBuilder.build(InteractionBuilder.java:187) at com.netflix.spinnaker.orca.pipeline.util.ArtifactUtilsSpec.should find artifacts without a specific stage ref_closure27(ArtifactUtilsSpec.groovy:382) at app//groovy.lang.Closure.call(Closure.java:412) at app//org.spockframework.lang.SpecInternals.createMock(SpecInternals.java:50) at app//org.spockframework.lang.SpecInternals.createMockImpl(SpecInternals.java:302) at app//org.spockframework.lang.SpecInternals.createMockImpl(SpecInternals.java:292) at app//org.spockframework.lang.SpecInternals.StubImpl(SpecInternals.java:137) at com.netflix.spinnaker.orca.pipeline.util.ArtifactUtilsSpec.should find artifacts without a specific stage ref(ArtifactUtilsSpec.groovy:378) 1 test completed, 1 failed > Task :orca-core:test FAILED ``` To fix this issue replaced Stub() with Mock().
- Loading branch information