Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-jcieslak committed Nov 13, 2024
1 parent 2508f68 commit ed12515
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
package resourceparametersassert

import (
"strings"

"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/acceptance/bettertestspoc/assert"

Check failure on line 4 in pkg/acceptance/bettertestspoc/assert/resourceparametersassert/task_resource_parameters_ext.go

View workflow job for this annotation

GitHub Actions / reviewdog

[golangci] reported by reviewdog 🐶 File is not `goimports`-ed (goimports) Raw Output: pkg/acceptance/bettertestspoc/assert/resourceparametersassert/task_resource_parameters_ext.go:4: File is not `goimports`-ed (goimports) "github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/acceptance/bettertestspoc/assert" "github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk"
"strings"

Check failure on line 6 in pkg/acceptance/bettertestspoc/assert/resourceparametersassert/task_resource_parameters_ext.go

View workflow job for this annotation

GitHub Actions / reviewdog

[golangci] reported by reviewdog 🐶 File is not `gofumpt`-ed (gofumpt) Raw Output: pkg/acceptance/bettertestspoc/assert/resourceparametersassert/task_resource_parameters_ext.go:6: File is not `gofumpt`-ed (gofumpt) "strings" "testing"
"testing"
)

// TaskDatasourceParameters is a temporary workaround to have better parameter assertions in data source acceptance tests.
func TaskDatasourceParameters(t *testing.T, name string) *TaskResourceParametersAssert {
t.Helper()

taskAssert := TaskResourceParametersAssert{
ResourceAssert: assert.NewDatasourceAssert("data."+name, "parameters", "tasks.0."),
}
taskAssert.AddAssertion(assert.ValueSet("parameters.#", "1"))
return &taskAssert
}

func (u *TaskResourceParametersAssert) HasAllDefaults() *TaskResourceParametersAssert {
return u.
HasSuspendTaskAfterNumFailures(10).
Expand Down
6 changes: 5 additions & 1 deletion pkg/datasources/tasks_acceptance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"bytes"
"fmt"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/acceptance/bettertestspoc/assert"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/acceptance/bettertestspoc/assert/resourceparametersassert"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/acceptance/bettertestspoc/assert/resourceshowoutputassert"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/acceptance/testenvs"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk"
Expand Down Expand Up @@ -68,7 +69,8 @@ func TestAcc_Tasks_Like_RootTask(t *testing.T) {
HasBudget("").
HasTaskRelations(sdk.TaskRelations{}).
HasLastSuspendedReason(""),
// TODO: Parameters
resourceparametersassert.TaskDatasourceParameters(t, "snowflake_tasks.test").
HasAllDefaults(),
),
},
{
Expand Down Expand Up @@ -161,12 +163,14 @@ func TestAcc_Tasks_Limit(t *testing.T) {
tfversion.RequireAbove(tfversion.Version1_5_0),
},
Steps: []resource.TestStep{
// Limit with prefix
{
Config: taskDatasourceLimitWithPrefix(2, prefix),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("data.snowflake_tasks.test", "tasks.#", "2"),
),
},
// Only limit
{
Config: taskDatasourceLimit(1),
Check: resource.ComposeTestCheckFunc(
Expand Down

0 comments on commit ed12515

Please sign in to comment.