Skip to content

Commit

Permalink
Merge pull request #197 from rundeck/issue/196
Browse files Browse the repository at this point in the history
Fix #196 rd run --loglevel debug should work
  • Loading branch information
gschueler authored Sep 18, 2018
2 parents 5f301d1 + 893cd63 commit f5cf35d
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
30 changes: 30 additions & 0 deletions src/test/groovy/org/rundeck/client/tool/commands/RunSpec.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f5cf35d

Please sign in to comment.