Skip to content

Commit

Permalink
refactor(clouddriver/test): refactor Spy.with{} closure during upgrad…
Browse files Browse the repository at this point in the history
…e to groovy 3.x (#4545)

While upgrading groovy 3.0.10 and spockframework 2.0-groovy-3.0, encountered the following errors in groovy test orca-clouddriver module:

```
No signature of method: com.netflix.spinnaker.orca.clouddriver.pipeline.servergroup.strategies.AbstractDeployStrategyStage.getNoStrat() is applicable for argument types: () values: []
Possible solutions: getNoStrategy(), setNoStrategy(com.netflix.spinnaker.orca.clouddriver.pipeline.servergroup.strategies.NoStrategy)
groovy.lang.MissingMethodException: No signature of method: com.netflix.spinnaker.orca.clouddriver.pipeline.servergroup.strategies.AbstractDeployStrategyStage.getNoStrat() is applicable for argument types: () values: []
Possible solutions: getNoStrategy(), setNoStrategy(com.netflix.spinnaker.orca.clouddriver.pipeline.servergroup.strategies.NoStrategy)
	at com.netflix.spinnaker.orca.clouddriver.pipeline.servergroup.strategies.AbstractDeployStrategyStageSpec.should compose list of steps_closure4(AbstractDeployStrategyStageSpec.groovy:51)
	at app//groovy.lang.Closure.call(Closure.java:412)
	at app//groovy.lang.Closure.call(Closure.java:428)
	at com.netflix.spinnaker.orca.clouddriver.pipeline.servergroup.strategies.AbstractDeployStrategyStageSpec.should compose list of steps(AbstractDeployStrategyStageSpec.groovy:50)

No signature of method: com.netflix.spinnaker.orca.clouddriver.pipeline.servergroup.strategies.AbstractDeployStrategyStage.getNoStrat() is applicable for argument types: () values: []
Possible solutions: getNoStrategy(), setNoStrategy(com.netflix.spinnaker.orca.clouddriver.pipeline.servergroup.strategies.NoStrategy)
groovy.lang.MissingMethodException: No signature of method: com.netflix.spinnaker.orca.clouddriver.pipeline.servergroup.strategies.AbstractDeployStrategyStage.getNoStrat() is applicable for argument types: () values: []
Possible solutions: getNoStrategy(), setNoStrategy(com.netflix.spinnaker.orca.clouddriver.pipeline.servergroup.strategies.NoStrategy)
	at com.netflix.spinnaker.orca.clouddriver.pipeline.servergroup.strategies.AbstractDeployStrategyStageSpec.should compose list of steps_closure4(AbstractDeployStrategyStageSpec.groovy:51)
	at app//groovy.lang.Closure.call(Closure.java:412)
	at app//groovy.lang.Closure.call(Closure.java:428)
	at com.netflix.spinnaker.orca.clouddriver.pipeline.servergroup.strategies.AbstractDeployStrategyStageSpec.should compose list of steps(AbstractDeployStrategyStageSpec.groovy:50)

No signature of method: com.netflix.spinnaker.orca.clouddriver.pipeline.servergroup.strategies.AbstractDeployStrategyStage.getNoStrat() is applicable for argument types: () values: []
Possible solutions: getNoStrategy(), setNoStrategy(com.netflix.spinnaker.orca.clouddriver.pipeline.servergroup.strategies.NoStrategy)
groovy.lang.MissingMethodException: No signature of method: com.netflix.spinnaker.orca.clouddriver.pipeline.servergroup.strategies.AbstractDeployStrategyStage.getNoStrat() is applicable for argument types: () values: []
Possible solutions: getNoStrategy(), setNoStrategy(com.netflix.spinnaker.orca.clouddriver.pipeline.servergroup.strategies.NoStrategy)
	at com.netflix.spinnaker.orca.clouddriver.pipeline.servergroup.strategies.AbstractDeployStrategyStageSpec.should compose list of steps_closure4(AbstractDeployStrategyStageSpec.groovy:51)
	at app//groovy.lang.Closure.call(Closure.java:412)
	at app//groovy.lang.Closure.call(Closure.java:428)
	at com.netflix.spinnaker.orca.clouddriver.pipeline.servergroup.strategies.AbstractDeployStrategyStageSpec.should compose list of steps(AbstractDeployStrategyStageSpec.groovy:50)

No signature of method: com.netflix.spinnaker.orca.clouddriver.pipeline.servergroup.strategies.AbstractDeployStrategyStage.getNoStrat() is applicable for argument types: () values: []
Possible solutions: getNoStrategy(), setNoStrategy(com.netflix.spinnaker.orca.clouddriver.pipeline.servergroup.strategies.NoStrategy)
groovy.lang.MissingMethodException: No signature of method: com.netflix.spinnaker.orca.clouddriver.pipeline.servergroup.strategies.AbstractDeployStrategyStage.getNoStrat() is applicable for argument types: () values: []
Possible solutions: getNoStrategy(), setNoStrategy(com.netflix.spinnaker.orca.clouddriver.pipeline.servergroup.strategies.NoStrategy)
	at com.netflix.spinnaker.orca.clouddriver.pipeline.servergroup.strategies.AbstractDeployStrategyStageSpec.should compose list of steps_closure4(AbstractDeployStrategyStageSpec.groovy:51)
	at app//groovy.lang.Closure.call(Closure.java:412)
	at app//groovy.lang.Closure.call(Closure.java:428)
	at com.netflix.spinnaker.orca.clouddriver.pipeline.servergroup.strategies.AbstractDeployStrategyStageSpec.should compose list of steps(AbstractDeployStrategyStageSpec.groovy:50)
```
To fix this issue replaced with{} closure with individual properties of Spy object.
  • Loading branch information
j-sandy authored Sep 27, 2023
1 parent b34be07 commit 3101d8b
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,8 @@ class AbstractDeployStrategyStageSpec extends Specification {
def basicTask = task("basic", Task)

AbstractDeployStrategyStage testStage = Spy(AbstractDeployStrategyStage)
testStage.with {
strategies = [noStrat, aStrat, bStrat, cStrat]
noStrategy = noStrat
}
testStage.strategies = [noStrat, aStrat, bStrat, cStrat].asList()
testStage.noStrategy = noStrat

StageExecutionImpl stage = new StageExecutionImpl(PipelineExecutionImpl.newPipeline("orca"), "whatever", [strategy: specifiedStrategy])

Expand Down

0 comments on commit 3101d8b

Please sign in to comment.