feat(MariaDB): Min/Max acceptance test (#797)
* add min and max acc tests for mariadb
This commit is contained in:
parent
4d93772fd2
commit
30a01c3037
5 changed files with 414 additions and 138 deletions
|
|
@ -10,7 +10,7 @@ import (
|
|||
|
||||
"github.com/hashicorp/terraform-plugin-framework/providerserver"
|
||||
"github.com/hashicorp/terraform-plugin-go/tfprotov6"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-testing/config"
|
||||
"github.com/stackitcloud/terraform-provider-stackit/stackit"
|
||||
)
|
||||
|
||||
|
|
@ -511,3 +511,12 @@ func CreateDefaultLocalFile() os.File {
|
|||
|
||||
return *file
|
||||
}
|
||||
|
||||
func ConvertConfigVariable(variable config.Variable) string {
|
||||
tmpByteArray, _ := variable.MarshalJSON()
|
||||
// In case the variable is a string, the quotes should be removed
|
||||
if tmpByteArray[0] == '"' && tmpByteArray[len(tmpByteArray)-1] == '"' {
|
||||
return string(tmpByteArray[1 : len(tmpByteArray)-1])
|
||||
}
|
||||
return string(tmpByteArray)
|
||||
}
|
||||
|
|
|
|||
43
stackit/internal/testutil/testutil_test.go
Normal file
43
stackit/internal/testutil/testutil_test.go
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
package testutil
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-testing/config"
|
||||
)
|
||||
|
||||
func TestConvertConfigVariable(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
variable config.Variable
|
||||
want string
|
||||
}{
|
||||
{
|
||||
name: "string",
|
||||
variable: config.StringVariable("test"),
|
||||
want: "test",
|
||||
},
|
||||
{
|
||||
name: "bool: true",
|
||||
variable: config.BoolVariable(true),
|
||||
want: "true",
|
||||
},
|
||||
{
|
||||
name: "bool: false",
|
||||
variable: config.BoolVariable(false),
|
||||
want: "false",
|
||||
},
|
||||
{
|
||||
name: "integer",
|
||||
variable: config.IntegerVariable(10),
|
||||
want: "10",
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
if got := ConvertConfigVariable(tt.variable); got != tt.want {
|
||||
t.Errorf("ConvertConfigVariable() = %v, want %v", got, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue