-
Notifications
You must be signed in to change notification settings - Fork 427
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Task resource v1 readiness (#3113)
## Changes - Mostly done task resource refactor - Sweepers test fixed (they always added errors even when they're nil) - Minor changes in SDK (find out the bug with alter task and right now we're only supporting upper-cased warehouse names; added that to the field description) - Acceptance tests - The enabled field is not a three-valued boolean because it created certain issues when updating the task. The task status is very important for their management and working, so I decided to have them as regular boolean values that are either true or false, nothing in between. ## Next prs - Apply comments from #3086 - Data source - Move some of the logic to SDK - Refactor SDK suspend root logic for tasks (and overall suspend logic in SDK/resource) - Examples, documentation, and migration guide - More test cases for complicated DAG structures to show the resource can handle more complex structures - Analyze non-deterministic test cases - Refactor task resuming in task resource (most likely with the use of defer) because currently, there may be cases that error can cause tasks to be not resumed. - Test and see how the DAG of tasks could be owned by a role other than the one created with Terraform (also with less privileges, only to run the task). - Make config without $$ escapes needed - Check if more helper functions from user resource could be used in task resource. - Check in one acceptance test why finalizer task in show_output is not set (is that Snowflake or mapping error). - More tests for calling (`as` field) - #3113 (comment) - Re-generate and list all the issues with asserts and models - check test tasks_gen_integration_test.go:937 (and see why it's non deterministic). - Support session paramters ## References * [CREATE TASK](https://docs.snowflake.com/en/sql-reference/sql/create-task)
- Loading branch information
1 parent
9fd8f88
commit 0aba5c9
Showing
53 changed files
with
5,690 additions
and
1,419 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 0 additions & 22 deletions
22
pkg/acceptance/bettertestspoc/assert/objectassert/task_snowflake_gen.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
pkg/acceptance/bettertestspoc/assert/objectparametersassert/task_parameters_snowflake_gen.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
pkg/acceptance/bettertestspoc/assert/resourceassert/task_resource_ext.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package resourceassert | ||
|
||
import ( | ||
"fmt" | ||
"strconv" | ||
|
||
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk" | ||
|
||
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/acceptance/bettertestspoc/assert" | ||
) | ||
|
||
func (t *TaskResourceAssert) HasAfterIds(ids ...sdk.SchemaObjectIdentifier) *TaskResourceAssert { | ||
t.AddAssertion(assert.ValueSet("after.#", strconv.FormatInt(int64(len(ids)), 10))) | ||
for i, id := range ids { | ||
t.AddAssertion(assert.ValueSet(fmt.Sprintf("after.%d", i), id.FullyQualifiedName())) | ||
} | ||
return t | ||
} |
Oops, something went wrong.