diff --git a/src/test/groovy/PublishReportsStepTests.groovy b/src/test/groovy/PublishReportsStepTests.groovy index 06e1d4dcc..ffe2af6fa 100644 --- a/src/test/groovy/PublishReportsStepTests.groovy +++ b/src/test/groovy/PublishReportsStepTests.groovy @@ -18,7 +18,7 @@ class PublishReportsStepTests extends BasePipelineTest { binding.setVariable('env', env) binding.setProperty('docker', new Docker()) - binding.setProperty('infra', new Infra(true)) + binding.setProperty('infra', new Infra(trusted: true)) helper.registerAllowedMethod('error', [String.class], {s -> updateBuildStatus('FAILURE') @@ -32,7 +32,7 @@ class PublishReportsStepTests extends BasePipelineTest { @Test void test_without_trusted_infra() throws Exception { def script = loadScript(scriptName) - binding.setProperty('infra', new Infra(false)) + binding.setProperty('infra', new Infra(trusted: false)) // when running with !infra.isTrusted() try { script.call(null) diff --git a/src/test/groovy/RunBenchmarksStepTests.groovy b/src/test/groovy/RunBenchmarksStepTests.groovy index 0385ef254..04ba3d357 100644 --- a/src/test/groovy/RunBenchmarksStepTests.groovy +++ b/src/test/groovy/RunBenchmarksStepTests.groovy @@ -15,7 +15,7 @@ class RunBenchmarksStepTests extends BasePipelineTest { super.setUp() binding.setVariable('env', env) - binding.setProperty('infra', new Infra(true)) + binding.setProperty('infra', new Infra(trusted: true)) helper.registerAllowedMethod('archiveArtifacts', [Map.class], { m -> m }) helper.registerAllowedMethod('echo', [String.class], { s -> s }) diff --git a/src/test/groovy/mock/Infra.groovy b/src/test/groovy/mock/Infra.groovy index 3749065ee..854161471 100644 --- a/src/test/groovy/mock/Infra.groovy +++ b/src/test/groovy/mock/Infra.groovy @@ -5,18 +5,30 @@ package mock */ class Infra implements Serializable { - private final boolean result - public Infra(boolean result) { this.result = result } - public Infra() { this.result = false } - public void checkout() { } - public void checkout(repo) { } - public String retrieveMavenSettingsFile(String location) { return location } - public String runWithMaven(String cmd) { return cmd } - public String runMaven(mvn) { return mvn } - public String runMaven(mvn, jdk, foo, settings) { return 'OK' } - public String runMaven(mvn, jdk, foo, settings, toolEnv) { return mvn } - public String runWithJava(command, jdk) { return command } - public String runWithJava(command, jdk, foo, toolEnv) { return command } - public boolean isTrusted() { return result } + private boolean trusted + + public void checkout(String repo = null) { } + + public String retrieveMavenSettingsFile(String location) { + return location + } + + public Object runMaven(List options, String jdk = null, List extraEnv = null, String settingsFile = null, Boolean addToolEnv = null) { + def command = "mvn ${options.join(' ')}" + return runWithMaven(command, jdk, extraEnv, addToolEnv) + } + + public Object runWithMaven(String command, String jdk = null, List extraEnv = null, Boolean addToolEnv = null) { + return runWithJava(command, jdk, extraEnv, addToolEnv) + } + + public Object runWithJava(String command, String jdk = null, List extraEnv = null, Boolean addToolEnv = null) { + return command + } + + public boolean isTrusted() { + return trusted + } + public void maybePublishIncrementals() { } }