terraform-provider-dokploy/internal/provider/example_data_source_test.go
Brian Flad 6deb8ed836
Migrate to terraform-plugin-testing (#132)
Reference: https://discuss.hashicorp.com/t/announcing-the-terraform-plugin-testing-module/49914

This will ensure that developers cloning this template repository will get the most current Go module for provider testing.
2023-03-10 09:40:04 -05:00

30 lines
692 B
Go

package provider
import (
"testing"
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
)
func TestAccExampleDataSource(t *testing.T) {
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
Steps: []resource.TestStep{
// Read testing
{
Config: testAccExampleDataSourceConfig,
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr("data.scaffolding_example.test", "id", "example-id"),
),
},
},
})
}
const testAccExampleDataSourceConfig = `
data "scaffolding_example" "test" {
configurable_attribute = "example"
}
`