Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(tests): fix conflict of variable scope by renaming local var…
…iables during upgrade of groovy 3.x (#1341) While upgrading groovy 3.0.10 and spockframework 2.0-groovy-3.0, encountered the following errors in groovy test compilation of echo-core and echo-notifications modules: ``` startup failed: /echo/echo-core/src/test/groovy/com/netflix/spinnaker/echo/notification/AbstractEventNotificationAgentSpec.groovy: 42: The current scope already contains a variable of the name event @ line 42, column 43. Mock.sendNotifications(*_) >> { notifica ^ 1 error > Task :echo-core:compileTestGroovy FAILED ``` ``` startup failed: /echo/echo-notifications/src/test/groovy/com/netflix/spinnaker/echo/notification/GithubNotificationAgentSpec.groovy: 50: The current scope already contains a variable of the name status @ line 50, column 31. github.updateCheck(*_) >> { token, repo, sha, status -> ^ 1 error > Task :echo-notifications:compileTestGroovy FAILED startup failed: /echo/echo-notifications/src/test/groovy/com/netflix/spinnaker/echo/notification/GithubNotificationAgentSpec.groovy: 99: The current scope already contains a variable of the name status @ line 99, column 31. github.updateCheck(*_) >> { token, repo, sha, status -> ^ 1 error > Task :echo-notifications:compileTestGroovy FAILED ``` ``` startup failed: /echo/echo-notifications/src/test/groovy/com/netflix/spinnaker/echo/notification/GoogleChatNotificationAgentSpec.groovy: 63: The current scope already contains a variable of the name webhookURL @ line 63, column 35. googleChat.sendMessage(*_) >> { webhookURL, message -> ^ /echo/echo-notifications/src/test/groovy/com/netflix/spinnaker/echo/notification/GoogleChatNotificationAgentSpec.groovy: 63: The current scope already contains a variable of the name message @ line 63, column 35. googleChat.sendMessage(*_) >> { webhookURL, message -> ^ 2 errors > Task :echo-notifications:compileTestGroovy FAILED > Task :echo-notifications:compileTestGroovy FAILED startup failed: /echo/echo-notifications/src/test/groovy/com/netflix/spinnaker/echo/notification/GoogleChatNotificationAgentSpec.groovy: 92: The current scope already contains a variable of the name webhookURL @ line 92, column 35. googleChat.sendMessage(*_) >> { webhookURL, message -> ^ 1 error ``` ``` startup failed: /echo/echo-notifications/src/test/groovy/com/netflix/spinnaker/echo/notification/SlackNotificationAgentSpec.groovy: 36: The current scope already contains a variable of the name channel @ line 36, column 30. slack.sendMessage(*_) >> { message, channel, asUser -> ^ 1 error > Task :echo-notifications:compileTestGroovy FAILED > Task :echo-notifications:compileTestGroovy FAILED startup failed: /echo/echo-notifications/src/test/groovy/com/netflix/spinnaker/echo/notification/SlackNotificationAgentSpec.groovy: 62: The current scope already contains a variable of the name message @ line 62, column 30. slack.sendMessage(*_) >> { message, channel, asUser -> ^ /echo/echo-notifications/src/test/groovy/com/netflix/spinnaker/echo/notification/SlackNotificationAgentSpec.groovy: 62: The current scope already contains a variable of the name channel @ line 62, column 30. slack.sendMessage(*_) >> { message, channel, asUser -> ^ 2 errors startup failed: /echo/echo-notifications/src/test/groovy/com/netflix/spinnaker/echo/notification/SlackNotificationAgentSpec.groovy: 91: The current scope already contains a variable of the name channel @ line 91, column 30. slack.sendMessage(*_) >> { message, channel, asUser -> ^ 1 error > Task :echo-notifications:compileTestGroovy FAILED ``` To fix this issue renamed the local variables to avoid the scope confilct with global variables.
- Loading branch information