github.com/gophercloud/gophercloud@v1.11.0/internal/acceptance/openstack/workflow/v2/executions_test.go (about) 1 package v2 2 3 import ( 4 "testing" 5 6 "github.com/gophercloud/gophercloud/internal/acceptance/clients" 7 "github.com/gophercloud/gophercloud/internal/acceptance/tools" 8 "github.com/gophercloud/gophercloud/openstack/workflow/v2/executions" 9 th "github.com/gophercloud/gophercloud/testhelper" 10 ) 11 12 func TestExecutionsCreate(t *testing.T) { 13 client, err := clients.NewWorkflowV2Client() 14 th.AssertNoErr(t, err) 15 16 workflow, err := CreateWorkflow(t, client) 17 th.AssertNoErr(t, err) 18 defer DeleteWorkflow(t, client, workflow) 19 20 execution, err := CreateExecution(t, client, workflow) 21 th.AssertNoErr(t, err) 22 defer DeleteExecution(t, client, execution) 23 24 tools.PrintResource(t, execution) 25 } 26 27 func TestExecutionsList(t *testing.T) { 28 client, err := clients.NewWorkflowV2Client() 29 th.AssertNoErr(t, err) 30 31 workflow, err := CreateWorkflow(t, client) 32 th.AssertNoErr(t, err) 33 defer DeleteWorkflow(t, client, workflow) 34 35 execution, err := CreateExecution(t, client, workflow) 36 th.AssertNoErr(t, err) 37 defer DeleteExecution(t, client, execution) 38 39 list, err := ListExecutions(t, client, &executions.ListOpts{ 40 Description: &executions.ListFilter{ 41 Value: execution.Description, 42 }, 43 CreatedAt: &executions.ListDateFilter{ 44 Filter: executions.FilterGTE, 45 Value: execution.CreatedAt, 46 }, 47 Input: execution.Input, 48 }) 49 50 th.AssertNoErr(t, err) 51 th.AssertEquals(t, 1, len(list)) 52 53 tools.PrintResource(t, list) 54 }