File tree Expand file tree Collapse file tree 1 file changed +61
-0
lines changed Expand file tree Collapse file tree 1 file changed +61
-0
lines changed Original file line number Diff line number Diff line change @@ -290,6 +290,67 @@ func TestResourceJobCreate_MultiTask(t *testing.T) {
290290 assert .Equal (t , "789" , d .Id ())
291291}
292292
293+ func TestResourceJobCreate_ConditionTask (t * testing.T ) {
294+ d , err := qa.ResourceFixture {
295+ Fixtures : []qa.HTTPFixture {
296+ {
297+ Method : "POST" ,
298+ Resource : "/api/2.1/jobs/create" ,
299+ ExpectedRequest : JobSettings {
300+ Name : "ConditionTaskTesting" ,
301+ Tasks : []JobTaskSettings {
302+ {
303+ TaskKey : "a" ,
304+ ConditionTask : & jobs.ConditionTask {
305+ Left : "123" ,
306+ Op : "EQUAL_TO" ,
307+ Right : "123" ,
308+ },
309+ },
310+ },
311+ MaxConcurrentRuns : 1 ,
312+ },
313+ Response : Job {
314+ JobID : 231 ,
315+ },
316+ },
317+ {
318+ Method : "GET" ,
319+ Resource : "/api/2.1/jobs/get?job_id=231" ,
320+ Response : Job {
321+ // good enough for mock
322+ Settings : & JobSettings {
323+ Tasks : []JobTaskSettings {
324+ {
325+ TaskKey : "a" ,
326+ ConditionTask : & jobs.ConditionTask {
327+ Left : "123" ,
328+ Op : "EQUAL_TO" ,
329+ Right : "123" ,
330+ },
331+ },
332+ },
333+ },
334+ },
335+ },
336+ },
337+ Create : true ,
338+ Resource : ResourceJob (),
339+ HCL : `
340+ name = "ConditionTaskTesting"
341+
342+ task {
343+ task_key = "a"
344+ condition_task {
345+ left = "123"
346+ op = "EQUAL_TO"
347+ right = "123"
348+ }
349+ }` ,
350+ }.Apply (t )
351+ assert .NoError (t , err )
352+ assert .Equal (t , "231" , d .Id ())
353+ }
293354func TestResourceJobCreate_JobParameters (t * testing.T ) {
294355 d , err := qa.ResourceFixture {
295356 Fixtures : []qa.HTTPFixture {
You can’t perform that action at this time.
0 commit comments