diff --git a/src/main/java/org/rundeck/client/tool/options/RunBaseOptions.java b/src/main/java/org/rundeck/client/tool/options/RunBaseOptions.java index b53dfb96..8dfc814b 100644 --- a/src/main/java/org/rundeck/client/tool/options/RunBaseOptions.java +++ b/src/main/java/org/rundeck/client/tool/options/RunBaseOptions.java @@ -27,12 +27,12 @@ public interface RunBaseOptions extends JobIdentOptions, FollowOptions, OptionalProjectOptions, NodeFilterOptions { @Option(shortName = "l", longName = "loglevel", - description = "Run the command using the specified LEVEL. LEVEL can be verbose, info, warning, error.", + description = "Run the command using the specified LEVEL. LEVEL can be debug, verbose, info, warning, error.", defaultValue = {"info"}, - pattern = "(verbose|info|warning|error)") + pattern = "(debug|verbose|info|warning|error)") String getLoglevel(); - @Option(hidden = true, pattern = "(verbose|info|warning|error)") + @Option(hidden = true, pattern = "(debug|verbose|info|warning|error)") String getLogevel(); boolean isLogevel(); diff --git a/src/test/groovy/org/rundeck/client/tool/commands/RetrySpec.groovy b/src/test/groovy/org/rundeck/client/tool/commands/RetrySpec.groovy index ef8cc0da..bbeb3790 100644 --- a/src/test/groovy/org/rundeck/client/tool/commands/RetrySpec.groovy +++ b/src/test/groovy/org/rundeck/client/tool/commands/RetrySpec.groovy @@ -19,11 +19,9 @@ package org.rundeck.client.tool.commands import org.rundeck.client.api.RundeckApi import org.rundeck.client.api.model.Execution import org.rundeck.client.api.model.JobFileUploadResult -import org.rundeck.client.api.model.JobItem import org.rundeck.client.api.model.JobRun import org.rundeck.client.tool.RdApp import org.rundeck.client.tool.options.RetryBaseOptions -import org.rundeck.client.tool.options.RunBaseOptions import org.rundeck.client.util.Client import org.rundeck.toolbelt.CommandOutput import org.rundeck.toolbelt.InputError diff --git a/src/test/groovy/org/rundeck/client/tool/commands/RunSpec.groovy b/src/test/groovy/org/rundeck/client/tool/commands/RunSpec.groovy index 66bd6c36..826d217c 100644 --- a/src/test/groovy/org/rundeck/client/tool/commands/RunSpec.groovy +++ b/src/test/groovy/org/rundeck/client/tool/commands/RunSpec.groovy @@ -64,6 +64,36 @@ class RunSpec extends Specification { 0 * api._(*_) result + } + def "run command loglevel debug"() { + + given: + def api = Mock(RundeckApi) + + def opts = Mock(RunBaseOptions) { + isJob() >> true + isProject() >> true + getProject() >> 'ProjectName' + getJob() >> 'a group/path/a job' + getLoglevel()>>'debug' + } + def retrofit = new Retrofit.Builder().baseUrl('http://example.com/fake/').build() + def client = new Client(api, retrofit, null, null, 17, true, null) + def hasclient = Mock(RdApp) { + getClient() >> client + } + Run run = new Run(hasclient) + def out = Mock(CommandOutput) + when: + def result = run.run(opts, out) + + then: + 1 * api.listJobs('ProjectName', null, null, 'a job', 'a group/path') >> + Calls.response([new JobItem(id: 'fakeid')]) + 1 * api.runJob('fakeid', null, 'DEBUG', null, null) >> Calls.response(new Execution(id: 123, description: '')) + 0 * api._(*_) + result + } @Unroll