Skip to content

Commit

Permalink
r/aws_glue_job(test): add job_run_queuing_enabled test
Browse files Browse the repository at this point in the history
```console
% make testacc PKG=glue TESTS=TestAccGlueJob_jobRunQueuingEnabled
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.0 test ./internal/service/glue/... -v -count 1 -parallel 20 -run='TestAccGlueJob_jobRunQueuingEnabled'  -timeout 360m

--- PASS: TestAccGlueJob_jobRunQueuingEnabled (21.69s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/glue       27.816s
```
  • Loading branch information
jar-b committed Aug 29, 2024
1 parent 886dd9b commit ed96863
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions internal/service/glue/job_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,43 @@ func TestAccGlueJob_executionProperty(t *testing.T) {
})
}

func TestAccGlueJob_jobRunQueuingEnabled(t *testing.T) {
ctx := acctest.Context(t)
var job awstypes.Job
rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix)
resourceName := "aws_glue_job.test"

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { acctest.PreCheck(ctx, t) },
ErrorCheck: acctest.ErrorCheck(t, names.GlueServiceID),
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories,
CheckDestroy: testAccCheckJobDestroy(ctx),
Steps: []resource.TestStep{
{
Config: testAccJobConfig_jobRunQueuingEnabled(rName, true),
Check: resource.ComposeTestCheckFunc(
testAccCheckJobExists(ctx, resourceName, &job),
resource.TestCheckResourceAttr(resourceName, names.AttrName, rName),
resource.TestCheckResourceAttr(resourceName, "job_run_queuing_enabled", acctest.CtTrue),
),
},
{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
},
{
Config: testAccJobConfig_jobRunQueuingEnabled(rName, false),
Check: resource.ComposeTestCheckFunc(
testAccCheckJobExists(ctx, resourceName, &job),
resource.TestCheckResourceAttr(resourceName, names.AttrName, rName),
resource.TestCheckResourceAttr(resourceName, "job_run_queuing_enabled", acctest.CtFalse),
),
},
},
})
}

func TestAccGlueJob_maintenanceWindow(t *testing.T) {
ctx := acctest.Context(t)
var job awstypes.Job
Expand Down Expand Up @@ -1158,6 +1195,23 @@ resource "aws_glue_job" "test" {
`, rName))
}

func testAccJobConfig_jobRunQueuingEnabled(rName string, jobRunQueuingEnabled bool) string {
return acctest.ConfigCompose(testAccJobConfig_base(rName), fmt.Sprintf(`
resource "aws_glue_job" "test" {
max_capacity = 10
name = %[1]q
role_arn = aws_iam_role.test.arn
job_run_queuing_enabled = %[2]t
command {
script_location = "testscriptlocation"
}
depends_on = [aws_iam_role_policy_attachment.test]
}
`, rName, jobRunQueuingEnabled))
}

func testAccJobConfig_tags1(rName, tagKey1, tagValue1 string) string {
return acctest.ConfigCompose(testAccJobConfig_base(rName), fmt.Sprintf(`
resource "aws_glue_job" "test" {
Expand Down

0 comments on commit ed96863

Please sign in to comment.