Skip to content

Commit

Permalink
Added test
Browse files Browse the repository at this point in the history
  • Loading branch information
fdevans committed Oct 7, 2023
1 parent 1562dcf commit 6bc4943
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 3 deletions.
47 changes: 47 additions & 0 deletions rundeck/resource_job_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,22 @@ func TestAccJobOptions_empty_choice(t *testing.T) {
})
}

func TestAccJobOptions_secure_choice(t *testing.T) {
var job JobDetail

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccJobCheckDestroy(&job),
Steps: []resource.TestStep{
{
Config: testAccJobOptions_secure_options,
ExpectError: regexp.MustCompile("argument \"value_choices\" can not have empty values; try \"required\""),
},
},
})
}

const testAccJobConfig_basic = `
resource "rundeck_project" "test" {
name = "terraform-acc-test-job"
Expand Down Expand Up @@ -420,3 +436,34 @@ resource "rundeck_job" "test" {
}
}
`

const testAccJobOptions_secure_options = `
resource "rundeck_project" "test" {
name = "terraform-acc-test-job-option-choices-empty"
description = "parent project for job acceptance tests"
resource_model_source {
type = "file"
config = {
format = "resourcexml"
file = "/tmp/terraform-acc-tests.xml"
}
}
}
resource "rundeck_job" "test" {
project_name = "${rundeck_project.test.name}"
name = "basic-job"
description = "A basic job"
option {
name = "foo_secure"
obscure_input = true
storage_path = "/keys/test/path/"
}
command {
description = "Prints Hello World"
shell_command = "echo Hello World"
}
}
`
6 changes: 3 additions & 3 deletions website/docs/r/job.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,6 @@ The following arguments are supported:
* `nodes_selected_by_default`: (Optional) Boolean controlling whether nodes that match the node_query_filter are
selected by default or not.

* `option`: (Optional) Nested block defining an option a user may set when executing this job. A
job may have any number of options. The structure of this nested block is described below.

* `command`: (Required) Nested block defining one step in the job workflow. A job must have one or
more commands. The structure of this nested block is described below.

Expand All @@ -134,6 +131,9 @@ The following arguments are supported:
* `notification`: (Optional) Nested block defining notifications on the job workflow. The structure of this nested block
is described below.

* `option`: (Optional) Nested block defining an option a user may set when executing this job. A
job may have any number of options. The structure of this nested block is described below.

`option` blocks have the following structure:

* `name`: (Required) Unique name that will be shown in the UI when entering values and used as
Expand Down

0 comments on commit 6bc4943

Please sign in to comment.