-
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.
- Loading branch information
1 parent
f673c18
commit b2fc163
Showing
10 changed files
with
203 additions
and
71 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
66 changes: 66 additions & 0 deletions
66
pkg/acceptance/bettertestspoc/assert/resource_parameter_assertions.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,66 @@ | ||
package assert | ||
|
||
import ( | ||
"strconv" | ||
"strings" | ||
|
||
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk" | ||
) | ||
|
||
const ( | ||
parametersPrefix = "parameters.0." | ||
parametersValueSuffix = ".0.value" | ||
parametersLevelSuffix = ".0.level" | ||
) | ||
|
||
func ResourceParameterBoolValueSet[T ~string](parameterName T, expected bool) ResourceAssertion { | ||
return ResourceParameterValueSet(parameterName, strconv.FormatBool(expected)) | ||
} | ||
|
||
func ResourceParameterBoolValueNotSet[T ~string](parameterName T) ResourceAssertion { | ||
return ResourceParameterValueNotSet(parameterName) | ||
} | ||
|
||
func ResourceParameterBoolValuePresent[T ~string](parameterName T) ResourceAssertion { | ||
return ResourceParameterValuePresent(parameterName) | ||
} | ||
|
||
func ResourceParameterIntValueSet[T ~string](parameterName T, expected int) ResourceAssertion { | ||
return ResourceParameterValueSet(parameterName, strconv.Itoa(expected)) | ||
} | ||
|
||
func ResourceParameterIntValueNotSet[T ~string](parameterName T) ResourceAssertion { | ||
return ResourceParameterValueNotSet(parameterName) | ||
} | ||
|
||
func ResourceParameterIntValuePresent[T ~string](parameterName T) ResourceAssertion { | ||
return ResourceParameterValuePresent(parameterName) | ||
} | ||
|
||
func ResourceParameterStringUnderlyingValueSet[T ~string, U ~string](parameterName T, expected U) ResourceAssertion { | ||
return ResourceParameterValueSet(parameterName, string(expected)) | ||
} | ||
|
||
func ResourceParameterStringUnderlyingValueNotSet[T ~string](parameterName T) ResourceAssertion { | ||
return ResourceParameterValueNotSet(parameterName) | ||
} | ||
|
||
func ResourceParameterStringUnderlyingValuePresent[T ~string](parameterName T) ResourceAssertion { | ||
return ResourceParameterValuePresent(parameterName) | ||
} | ||
|
||
func ResourceParameterValueSet[T ~string](parameterName T, expected string) ResourceAssertion { | ||
return ResourceAssertion{fieldName: parametersPrefix + strings.ToLower(string(parameterName)) + parametersValueSuffix, expectedValue: expected, resourceAssertionType: resourceAssertionTypeValueSet} | ||
} | ||
|
||
func ResourceParameterValueNotSet[T ~string](parameterName T) ResourceAssertion { | ||
return ResourceAssertion{fieldName: parametersPrefix + strings.ToLower(string(parameterName)) + parametersValueSuffix, resourceAssertionType: resourceAssertionTypeValueNotSet} | ||
} | ||
|
||
func ResourceParameterValuePresent[T ~string](parameterName T) ResourceAssertion { | ||
return ResourceAssertion{fieldName: parametersPrefix + strings.ToLower(string(parameterName)) + parametersValueSuffix, resourceAssertionType: resourceAssertionTypeValuePresent} | ||
} | ||
|
||
func ResourceParameterLevelSet[T ~string](parameterName T, parameterType sdk.ParameterType) ResourceAssertion { | ||
return ResourceAssertion{fieldName: parametersPrefix + strings.ToLower(string(parameterName)) + parametersLevelSuffix, expectedValue: string(parameterType), resourceAssertionType: resourceAssertionTypeValueSet} | ||
} |
67 changes: 67 additions & 0 deletions
67
pkg/acceptance/bettertestspoc/assert/resource_show_assertions.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,67 @@ | ||
package assert | ||
|
||
import ( | ||
"strconv" | ||
) | ||
|
||
const showOutputPrefix = "show_output.0." | ||
|
||
func ResourceShowOutputBoolValueSet(fieldName string, expected bool) ResourceAssertion { | ||
return ResourceShowOutputValueSet(fieldName, strconv.FormatBool(expected)) | ||
} | ||
|
||
func ResourceShowOutputBoolValueNotSet(fieldName string) ResourceAssertion { | ||
return ResourceShowOutputValueNotSet(fieldName) | ||
} | ||
|
||
func ResourceShowOutputBoolValuePresent(fieldName string) ResourceAssertion { | ||
return ResourceShowOutputValuePresent(fieldName) | ||
} | ||
|
||
func ResourceShowOutputIntValueSet(fieldName string, expected int) ResourceAssertion { | ||
return ResourceShowOutputValueSet(fieldName, strconv.Itoa(expected)) | ||
} | ||
|
||
func ResourceShowOutputIntValueNotSet(fieldName string) ResourceAssertion { | ||
return ResourceShowOutputValueNotSet(fieldName) | ||
} | ||
|
||
func ResourceShowOutputIntValuePresent(fieldName string) ResourceAssertion { | ||
return ResourceShowOutputValuePresent(fieldName) | ||
} | ||
|
||
func ResourceShowOutputFloatValueSet(fieldName string, expected float64) ResourceAssertion { | ||
return ResourceShowOutputValueSet(fieldName, strconv.FormatFloat(expected, 'f', -1, 64)) | ||
} | ||
|
||
func ResourceShowOutputFloatValueNotSet(fieldName string) ResourceAssertion { | ||
return ResourceShowOutputValueNotSet(fieldName) | ||
} | ||
|
||
func ResourceShowOutputFloatValuePresent(fieldName string) ResourceAssertion { | ||
return ResourceShowOutputValuePresent(fieldName) | ||
} | ||
|
||
func ResourceShowOutputStringUnderlyingValueSet[U ~string](fieldName string, expected U) ResourceAssertion { | ||
return ResourceShowOutputValueSet(fieldName, string(expected)) | ||
} | ||
|
||
func ResourceShowOutputStringUnderlyingValueNotSet(fieldName string) ResourceAssertion { | ||
return ResourceShowOutputValueNotSet(fieldName) | ||
} | ||
|
||
func ResourceShowOutputStringUnderlyingValuePresent(fieldName string) ResourceAssertion { | ||
return ResourceShowOutputValuePresent(fieldName) | ||
} | ||
|
||
func ResourceShowOutputValueSet(fieldName string, expected string) ResourceAssertion { | ||
return ResourceAssertion{fieldName: showOutputPrefix + fieldName, expectedValue: expected, resourceAssertionType: resourceAssertionTypeValueSet} | ||
} | ||
|
||
func ResourceShowOutputValueNotSet(fieldName string) ResourceAssertion { | ||
return ResourceAssertion{fieldName: showOutputPrefix + fieldName, resourceAssertionType: resourceAssertionTypeValueNotSet} | ||
} | ||
|
||
func ResourceShowOutputValuePresent(fieldName string) ResourceAssertion { | ||
return ResourceAssertion{fieldName: showOutputPrefix + fieldName, resourceAssertionType: resourceAssertionTypeValuePresent} | ||
} |
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
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
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
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