Skip to content

Commit

Permalink
Add acceptance test for periodic triggers
Browse files Browse the repository at this point in the history
  • Loading branch information
alexmos-db committed Jun 28, 2024
1 parent 9bbbd98 commit a9aed53
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions internal/acceptance/job_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -413,3 +413,36 @@ func TestAccRemoveWebhooks(t *testing.T) {
`,
})
}

func TestAccPeriodicTrigger(t *testing.T) {
workspaceLevel(t, step{
Template: `
resource "databricks_job" "this" {
name = "{var.RANDOM}"
trigger {
pause_status = "UNPAUSED"
periodic {
interval = 17
unit = "HOURS"
}
}
}`,
Check: resourceCheck("databricks_job.this", func(ctx context.Context, client *common.DatabricksClient, id string) error {
w, err := client.WorkspaceClient()
assert.NoError(t, err)

jobID, err := strconv.ParseInt(id, 10, 64)
assert.NoError(t, err)

res, err := w.Jobs.GetByJobId(ctx, jobID)
assert.NoError(t, err)

assert.Equal(t, jobs.PauseStatus("UNPAUSED"), res.Settings.Trigger.PauseStatus)
assert.Equal(t, 17, res.Settings.Trigger.Periodic.Interval)
assert.Equal(t, jobs.PeriodicTriggerConfigurationTimeUnit("HOURS"), res.Settings.Trigger.Periodic.Unit)

return nil
}),
})
}

0 comments on commit a9aed53

Please sign in to comment.