-
Notifications
You must be signed in to change notification settings - Fork 420
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Introduce assertions generators part2 (#2956)
Continuation to #2952. Main features: - missing generators (4) added - definitions of generateable objects extracted to allow an easier reuse - common extractor for schemas added
- Loading branch information
1 parent
f70e40e
commit f715e8a
Showing
67 changed files
with
3,331 additions
and
1,139 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
38 changes: 38 additions & 0 deletions
38
pkg/acceptance/bettertestspoc/assert/objectassert/gen/sdk_object_def.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,38 @@ | ||
package gen | ||
|
||
import ( | ||
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/internal/genhelpers" | ||
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk" | ||
) | ||
|
||
type SdkObjectDef struct { | ||
IdType string | ||
ObjectType sdk.ObjectType | ||
ObjectStruct any | ||
} | ||
|
||
var allStructs = []SdkObjectDef{ | ||
{ | ||
IdType: "sdk.AccountObjectIdentifier", | ||
ObjectType: sdk.ObjectTypeUser, | ||
ObjectStruct: sdk.User{}, | ||
}, | ||
{ | ||
IdType: "sdk.AccountObjectIdentifier", | ||
ObjectType: sdk.ObjectTypeWarehouse, | ||
ObjectStruct: sdk.Warehouse{}, | ||
}, | ||
} | ||
|
||
func GetSdkObjectDetails() []genhelpers.SdkObjectDetails { | ||
allSdkObjectsDetails := make([]genhelpers.SdkObjectDetails, len(allStructs)) | ||
for idx, d := range allStructs { | ||
structDetails := genhelpers.ExtractStructDetails(d.ObjectStruct) | ||
allSdkObjectsDetails[idx] = genhelpers.SdkObjectDetails{ | ||
IdType: d.IdType, | ||
ObjectType: d.ObjectType, | ||
StructDetails: structDetails, | ||
} | ||
} | ||
return allSdkObjectsDetails | ||
} |
2 changes: 1 addition & 1 deletion
2
pkg/acceptance/bettertestspoc/assert/objectassert/gen/templates/preamble.tmpl
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
2 changes: 1 addition & 1 deletion
2
pkg/acceptance/bettertestspoc/assert/objectassert/user_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/objectassert/warehouse_snowflake_gen.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
22 changes: 0 additions & 22 deletions
22
pkg/acceptance/bettertestspoc/assert/objectparametersassert/gen/commons.go
This file was deleted.
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
Oops, something went wrong.