-
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.
Clean old assertions: - replace `checkBool` - replace `snowflakechecks` for warehouse with already generated new assertions - replace `snowflakechecks` for database with new generated assertions - generated object assertions for the database - generated parameter assertions for the database - written assertions for the database describe (they are not generateable yet) Other: - renamed methods in `resource_helpers_read.go`
- Loading branch information
1 parent
426ddb1
commit ad657eb
Showing
23 changed files
with
934 additions
and
376 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
189 changes: 189 additions & 0 deletions
189
pkg/acceptance/bettertestspoc/assert/objectassert/database_snowflake_gen.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
46 changes: 46 additions & 0 deletions
46
pkg/acceptance/bettertestspoc/assert/objectassert/describe_database_snowflake_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,46 @@ | ||
package objectassert | ||
|
||
import ( | ||
"fmt" | ||
"slices" | ||
"testing" | ||
|
||
acc "github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/acceptance" | ||
|
||
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/acceptance/bettertestspoc/assert" | ||
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk" | ||
) | ||
|
||
// TODO [SNOW-1501905]: this file should be fully regenerated when adding and option to assert the results of describe | ||
type DatabaseDescribeAssert struct { | ||
*assert.SnowflakeObjectAssert[sdk.DatabaseDetails, sdk.AccountObjectIdentifier] | ||
} | ||
|
||
func DatabaseDescribe(t *testing.T, id sdk.AccountObjectIdentifier) *DatabaseDescribeAssert { | ||
t.Helper() | ||
return &DatabaseDescribeAssert{ | ||
assert.NewSnowflakeObjectAssertWithProvider(sdk.ObjectType("DATABASE_DETAILS"), id, acc.TestClient().Database.Describe), | ||
} | ||
} | ||
|
||
func (d *DatabaseDescribeAssert) DoesNotContainPublicSchema() *DatabaseDescribeAssert { | ||
d.AddAssertion(func(t *testing.T, o *sdk.DatabaseDetails) error { | ||
t.Helper() | ||
if slices.ContainsFunc(o.Rows, func(row sdk.DatabaseDetailsRow) bool { return row.Name == "PUBLIC" && row.Kind == "SCHEMA" }) { | ||
return fmt.Errorf("expected database %s to not contain public schema", d.GetId()) | ||
} | ||
return nil | ||
}) | ||
return d | ||
} | ||
|
||
func (d *DatabaseDescribeAssert) ContainsPublicSchema() *DatabaseDescribeAssert { | ||
d.AddAssertion(func(t *testing.T, o *sdk.DatabaseDetails) error { | ||
t.Helper() | ||
if !slices.ContainsFunc(o.Rows, func(row sdk.DatabaseDetailsRow) bool { return row.Name == "PUBLIC" && row.Kind == "SCHEMA" }) { | ||
return fmt.Errorf("expected database %s to contain public schema", d.GetId()) | ||
} | ||
return nil | ||
}) | ||
return d | ||
} |
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
Oops, something went wrong.