mirror of
https://github.com/bpg/terraform-provider-proxmox.git
synced 2025-07-05 05:24:01 +00:00
fix(core): Do not limit cluster size to 1 in provider's ssh
config (#369)
fix(code): Do not limit cluster size to 1 Allow using repeated 'node' blocks in ssh configuration. Co-authored-by: Pavel Boldyrev <627562+bpg@users.noreply.github.com>
This commit is contained in:
parent
0aa33f0929
commit
926382c155
@ -58,6 +58,7 @@ func TestProviderSchema(t *testing.T) {
|
|||||||
mkProviderOTP,
|
mkProviderOTP,
|
||||||
mkProviderPassword,
|
mkProviderPassword,
|
||||||
mkProviderUsername,
|
mkProviderUsername,
|
||||||
|
mkProviderSSH,
|
||||||
})
|
})
|
||||||
|
|
||||||
test.AssertValueTypes(t, veSchema, map[string]schema.ValueType{
|
test.AssertValueTypes(t, veSchema, map[string]schema.ValueType{
|
||||||
@ -66,5 +67,11 @@ func TestProviderSchema(t *testing.T) {
|
|||||||
mkProviderOTP: schema.TypeString,
|
mkProviderOTP: schema.TypeString,
|
||||||
mkProviderPassword: schema.TypeString,
|
mkProviderPassword: schema.TypeString,
|
||||||
mkProviderUsername: schema.TypeString,
|
mkProviderUsername: schema.TypeString,
|
||||||
|
mkProviderSSH: schema.TypeList,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
providerSSHSchema := test.AssertNestedSchemaExistence(t, s, mkProviderSSH)
|
||||||
|
|
||||||
|
// do not limit number of nodes in the cluster
|
||||||
|
test.AssertListMaxItems(t, providerSSHSchema, mkProviderSSHNode, 0)
|
||||||
}
|
}
|
||||||
|
@ -197,7 +197,6 @@ func nestedProviderSchema() map[string]*schema.Schema {
|
|||||||
Type: schema.TypeList,
|
Type: schema.TypeList,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
MinItems: 0,
|
MinItems: 0,
|
||||||
MaxItems: 1,
|
|
||||||
Description: "Overrides for SSH connection configuration to a Proxmox node",
|
Description: "Overrides for SSH connection configuration to a Proxmox node",
|
||||||
Elem: &schema.Resource{
|
Elem: &schema.Resource{
|
||||||
Schema: map[string]*schema.Schema{
|
Schema: map[string]*schema.Schema{
|
||||||
|
@ -39,6 +39,16 @@ func AssertNestedSchemaExistence(t *testing.T, s *schema.Resource, key string) *
|
|||||||
return sh
|
return sh
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AssertListMaxItems checks that the given schema attribute has given expected MaxItems value.
|
||||||
|
func AssertListMaxItems(t *testing.T, s *schema.Resource, key string, expectedMaxItems int) {
|
||||||
|
t.Helper()
|
||||||
|
|
||||||
|
require.NotNil(t, s.Schema[key], "Error in Schema: Missing definition for \"%s\"", key)
|
||||||
|
assert.Equal(t, s.Schema[key].MaxItems, expectedMaxItems,
|
||||||
|
"Error in Schema: Argument \"%s\" has \"MaxItems: %#v\", but value %#v is expected!",
|
||||||
|
key, s.Schema[key].MaxItems, expectedMaxItems)
|
||||||
|
}
|
||||||
|
|
||||||
// AssertOptionalArguments checks that the given schema has the given optional arguments.
|
// AssertOptionalArguments checks that the given schema has the given optional arguments.
|
||||||
func AssertOptionalArguments(t *testing.T, s *schema.Resource, keys []string) {
|
func AssertOptionalArguments(t *testing.T, s *schema.Resource, keys []string) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
|
Loading…
Reference in New Issue
Block a user