example_data_source_test.go 762 B

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