Skip to content

Commit

Permalink
fix test issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ronaveva committed Mar 28, 2024
1 parent 7f1e77b commit 3a33308
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
12 changes: 9 additions & 3 deletions rundeckapp/grails-app/domain/rundeck/ScheduledExecution.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,15 @@ class ScheduledExecution extends ExecutionContext implements JobData, EmbeddedJs
map.scheduleEnabled = hasScheduleEnabled()
map.executionEnabled = hasExecutionEnabled()
map.nodeFilterEditable = hasNodeFilterEditable()
map.modifierUserName = modifierUserName
map.modifiedDate = modifiedDate
map.historyId = historyId
if(modifierUserName){
map.modifierUserName = modifierUserName
}
if(modifiedDate){
map.modifiedDate = modifiedDate
}
if(historyId){
map.historyId = historyId
}

if(groupPath){
map.group=groupPath
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,20 @@ class ScheduledExecutionControllerSpec extends RundeckHibernateSpec implements C
def "job history"() {
given:
def jobUuid = "13ffa515-98be-4988-8e80-af0ebabf0bb1"
controller.apiService = Mock(ApiService)
controller.apiService = Mock(ApiService){
1 * requireApi(_,_) >> true
1 * requireParameters(_, _, ['id']) >> true
}
JobHistory jh = new JobHistory(userName: "pepito", jobDefinition: "- defaultTab: nodes\n" +
" description: ''")
jh.save()
" description: ''", dateCreated: new Date(), id: 1)
jh.save(flush:true)
controller.jobHistoryService = Mock(JobHistoryService){
getJobHistory(jobUuid) >> jh
getJobHistory(jobUuid) >> [jh]
}
controller.rundeckJobDefinitionManager = Mock(RundeckJobDefinitionManager){
exportAs(_,_,_)>>{
it[2].write('test output')
}
}
controller.response.format = "json"
when:
Expand All @@ -139,7 +147,7 @@ class ScheduledExecutionControllerSpec extends RundeckHibernateSpec implements C

controller.apiJobHistory()
then:
response.json == []
response.text == 'test output'
}

def "workflow json"() {
Expand Down Expand Up @@ -1637,7 +1645,7 @@ class ScheduledExecutionControllerSpec extends RundeckHibernateSpec implements C
controller.pluginService = Mock(PluginService)
controller.featureService = Mock(FeatureService)
controller.referencedExecutionDataProvider = new GormReferencedExecutionDataProvider()




Expand Down

0 comments on commit 3a33308

Please sign in to comment.