0
0
mirror of https://github.com/bpg/terraform-provider-proxmox.git synced 2025-07-04 04:22:59 +00:00
terraform-provider-proxmox/fwprovider/tests/datasource_version_test.go
Pavel Boldyrev 7d064a8b27
chore(code): re-organize and cleanup "fwk provider"'s code (#568)
* chore(code): code cleanup / renaming

* chore(code): flatten and rename fw provider package

* chore(code): refactor & update network tests
2023-09-17 22:50:24 +00:00

46 lines
1.2 KiB
Go

/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
package tests
import (
"context"
"fmt"
"strings"
"testing"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
)
func TestAccDatasourceVersion(t *testing.T) {
t.Parallel()
accProviders := testAccMuxProviders(context.Background(), t)
datasourceName := "data.proxmox_virtual_environment_version.test"
resource.Test(t, resource.TestCase{
ProtoV6ProviderFactories: accProviders,
Steps: []resource.TestStep{
// Read testing
{
Config: `data "proxmox_virtual_environment_version" "test" {}`,
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr(datasourceName, "release", "8.0"),
resource.TestCheckResourceAttrSet(datasourceName, "repository_id"),
resource.TestCheckResourceAttrWith(datasourceName, "version", func(value string) error {
if strings.HasPrefix(value, "8.0") {
return nil
}
return fmt.Errorf("version %s does not start with 8.0", value)
}),
resource.TestCheckResourceAttrSet(datasourceName, "id"),
),
},
},
})
}