example_data_source_test.go 692 B

1234567891011121314151617181920212223242526272829
  1. package provider
  2. import (
  3. "testing"
  4. "github.com/hashicorp/terraform-plugin-testing/helper/resource"
  5. )
  6. func TestAccExampleDataSource(t *testing.T) {
  7. resource.Test(t, resource.TestCase{
  8. PreCheck: func() { testAccPreCheck(t) },
  9. ProtoV6ProviderFactories: testAccProtoV6ProviderFactories,
  10. Steps: []resource.TestStep{
  11. // Read testing
  12. {
  13. Config: testAccExampleDataSourceConfig,
  14. Check: resource.ComposeAggregateTestCheckFunc(
  15. resource.TestCheckResourceAttr("data.scaffolding_example.test", "id", "example-id"),
  16. ),
  17. },
  18. },
  19. })
  20. }
  21. const testAccExampleDataSourceConfig = `
  22. data "scaffolding_example" "test" {
  23. configurable_attribute = "example"
  24. }
  25. `