Skip to content

Commit

Permalink
Changes after review
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-jcieslak committed Sep 23, 2024
1 parent a783bec commit fc5586e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
4 changes: 2 additions & 2 deletions pkg/acceptance/helpers/task_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ func (c *TaskClient) CreateWithRequest(t *testing.T, request *sdk.CreateTaskRequ
task, err := c.client().ShowByID(ctx, id)
require.NoError(t, err)

return task, c.DropTaskFunc(t, id)
return task, c.DropFunc(t, id)
}

func (c *TaskClient) DropTaskFunc(t *testing.T, id sdk.SchemaObjectIdentifier) func() {
func (c *TaskClient) DropFunc(t *testing.T, id sdk.SchemaObjectIdentifier) func() {
t.Helper()
ctx := context.Background()

Expand Down
27 changes: 14 additions & 13 deletions pkg/sdk/testint/tasks_gen_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func TestInt_Tasks(t *testing.T) {

err := testClient(t).Tasks.Create(ctx, sdk.NewCreateTaskRequest(id, sql))
require.NoError(t, err)
t.Cleanup(testClientHelper().Task.DropTaskFunc(t, id))
t.Cleanup(testClientHelper().Task.DropFunc(t, id))

task, err := testClientHelper().Task.Show(t, id)
require.NoError(t, err)
Expand All @@ -148,7 +148,7 @@ func TestInt_Tasks(t *testing.T) {

err := testClient(t).Tasks.Create(ctx, sdk.NewCreateTaskRequest(id, sql).WithWarehouse(*sdk.NewCreateTaskWarehouseRequest().WithUserTaskManagedInitialWarehouseSize(sdk.WarehouseSizeXSmall)))
require.NoError(t, err)
t.Cleanup(testClientHelper().Task.DropTaskFunc(t, id))
t.Cleanup(testClientHelper().Task.DropFunc(t, id))

task, err := testClientHelper().Task.Show(t, id)
require.NoError(t, err)
Expand Down Expand Up @@ -178,7 +178,7 @@ func TestInt_Tasks(t *testing.T) {
WithComment("some comment").
WithWhen(`SYSTEM$STREAM_HAS_DATA('MYSTREAM')`))
require.NoError(t, err)
t.Cleanup(testClientHelper().Task.DropTaskFunc(t, id))
t.Cleanup(testClientHelper().Task.DropFunc(t, id))

task, err := testClientHelper().Task.Show(t, id)
require.NoError(t, err)
Expand All @@ -192,11 +192,11 @@ func TestInt_Tasks(t *testing.T) {

err := testClient(t).Tasks.Create(ctx, sdk.NewCreateTaskRequest(rootTaskId, sql))
require.NoError(t, err)
t.Cleanup(testClientHelper().Task.DropTaskFunc(t, rootTaskId))
t.Cleanup(testClientHelper().Task.DropFunc(t, rootTaskId))

err = testClient(t).Tasks.Create(ctx, sdk.NewCreateTaskRequest(id, sql).WithAfter([]sdk.SchemaObjectIdentifier{rootTaskId}))
require.NoError(t, err)
t.Cleanup(testClientHelper().Task.DropTaskFunc(t, id))
t.Cleanup(testClientHelper().Task.DropFunc(t, id))

task, err := testClientHelper().Task.Show(t, id)
require.NoError(t, err)
Expand All @@ -211,15 +211,15 @@ func TestInt_Tasks(t *testing.T) {

err := testClient(t).Tasks.Create(ctx, sdk.NewCreateTaskRequest(rootTaskId, sql))
require.NoError(t, err)
t.Cleanup(testClientHelper().Task.DropTaskFunc(t, rootTaskId))
t.Cleanup(testClientHelper().Task.DropFunc(t, rootTaskId))

err = testClient(t).Tasks.Create(ctx, sdk.NewCreateTaskRequest(id, sql).WithAfter([]sdk.SchemaObjectIdentifier{rootTaskId}))
require.NoError(t, err)
t.Cleanup(testClientHelper().Task.DropTaskFunc(t, id))
t.Cleanup(testClientHelper().Task.DropFunc(t, id))

err = testClient(t).Tasks.Create(ctx, sdk.NewCreateTaskRequest(finalizerId, sql).WithFinalize(rootTaskId))
require.NoError(t, err)
t.Cleanup(testClientHelper().Task.DropTaskFunc(t, finalizerId))
t.Cleanup(testClientHelper().Task.DropFunc(t, finalizerId))

assertions.AssertThat(t, objectassert.Task(t, rootTaskId).
HasTaskRelations(sdk.TaskRelations{
Expand Down Expand Up @@ -348,11 +348,11 @@ func TestInt_Tasks(t *testing.T) {

err := testClient(t).Tasks.Create(ctx, sdk.NewCreateTaskRequest(rootTaskId, sql))
require.NoError(t, err)
t.Cleanup(testClientHelper().Task.DropTaskFunc(t, rootTaskId))
t.Cleanup(testClientHelper().Task.DropFunc(t, rootTaskId))

err = testClient(t).Tasks.Create(ctx, sdk.NewCreateTaskRequest(id, sql).WithAfter([]sdk.SchemaObjectIdentifier{rootTaskId}))
require.NoError(t, err)
t.Cleanup(testClientHelper().Task.DropTaskFunc(t, id))
t.Cleanup(testClientHelper().Task.DropFunc(t, id))

err = testClient(t).Tasks.Create(ctx, sdk.NewCreateTaskRequest(finalizerId, sql).WithFinalize(id))
require.ErrorContains(t, err, "cannot finalize a non-root task")
Expand Down Expand Up @@ -396,7 +396,7 @@ func TestInt_Tasks(t *testing.T) {
id := testClientHelper().Ids.RandomSchemaObjectIdentifier()
err := client.Tasks.Clone(ctx, sdk.NewCloneTaskRequest(id, sourceTask.ID()))
require.NoError(t, err)
t.Cleanup(testClientHelper().Task.DropTaskFunc(t, id))
t.Cleanup(testClientHelper().Task.DropFunc(t, id))

task, err := client.Tasks.ShowByID(ctx, id)
require.NoError(t, err)
Expand Down Expand Up @@ -431,6 +431,7 @@ func TestInt_Tasks(t *testing.T) {
WithWhen(`SYSTEM$STREAM_HAS_DATA('MYSTREAM')`),
)
require.NoError(t, err)
t.Cleanup(testClientHelper().Task.DropFunc(t, id))

task, err := client.Tasks.ShowByID(ctx, id)
require.NoError(t, err)
Expand Down Expand Up @@ -696,7 +697,7 @@ func TestInt_Tasks(t *testing.T) {
returnedTasks, err := client.Tasks.Show(ctx, sdk.NewShowTaskRequest().WithIn(sdk.In{Schema: testClientHelper().Ids.SchemaId()}))
require.NoError(t, err)

require.GreaterOrEqual(t, returnedTasks, 2)
require.Len(t, returnedTasks, 2)
assert.Contains(t, returnedTasks, *task1)
assert.Contains(t, returnedTasks, *task2)
})
Expand All @@ -709,7 +710,7 @@ func TestInt_Tasks(t *testing.T) {
returnedTasks, err := client.Tasks.Show(ctx, sdk.NewShowTaskRequest().WithIn(sdk.In{Schema: testClientHelper().Ids.SchemaId()}).WithTerse(true))
require.NoError(t, err)

require.GreaterOrEqual(t, returnedTasks, 1)
require.Len(t, returnedTasks, 1)
assertTaskTerse(t, &returnedTasks[0], task.ID(), "10 MINUTE")
})

Expand Down

0 comments on commit fc5586e

Please sign in to comment.