Skip to content

Commit

Permalink
comment out framework tests for now
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobbednarz committed Jan 20, 2023
1 parent 66f4394 commit 57c6e27
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 77 deletions.
47 changes: 20 additions & 27 deletions internal/framework/service/example/example_data_source_test.go
Original file line number Diff line number Diff line change
@@ -1,30 +1,23 @@
package example

import (
"testing"
// func TestAccExampleDataSource(t *testing.T) {
// resource.Test(t, resource.TestCase{
// PreCheck: func() { provider.TestAccPreCheck(t) },
// ProtoV6ProviderFactories: provider.TestAccProtoV6ProviderFactories,
// Steps: []resource.TestStep{
// // Read testing
// {
// Config: testAccExampleDataSourceConfig,
// Check: resource.ComposeAggregateTestCheckFunc(
// resource.TestCheckResourceAttr("data.scaffolding_example.test", "id", "example-id"),
// ),
// },
// },
// })
// }

"github.com/cloudflare/terraform-provider-cloudflare/internal/framework/provider"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
)

func TestAccExampleDataSource(t *testing.T) {
resource.Test(t, resource.TestCase{
PreCheck: func() { provider.TestAccPreCheck(t) },
ProtoV6ProviderFactories: provider.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"
}
`
// const testAccExampleDataSourceConfig = `
// data "scaffolding_example" "test" {
// configurable_attribute = "example"
// }
// `
92 changes: 42 additions & 50 deletions internal/framework/service/example/example_test.go
Original file line number Diff line number Diff line change
@@ -1,53 +1,45 @@
package example

import (
"fmt"
"testing"
// func TestAccExampleResource(t *testing.T) {
// resource.Test(t, resource.TestCase{
// PreCheck: func() { provider.TestAccPreCheck(t) },
// ProtoV6ProviderFactories: provider.TestAccProtoV6ProviderFactories,
// Steps: []resource.TestStep{
// // Create and Read testing
// {
// Config: testAccExampleResourceConfig("one"),
// Check: resource.ComposeAggregateTestCheckFunc(
// resource.TestCheckResourceAttr("scaffolding_example.test", "configurable_attribute", "one"),
// resource.TestCheckResourceAttr("scaffolding_example.test", "id", "example-id"),
// ),
// },
// // ImportState testing
// {
// ResourceName: "scaffolding_example.test",
// ImportState: true,
// ImportStateVerify: true,
// // This is not normally necessary, but is here because this
// // example code does not have an actual upstream service.
// // Once the Read method is able to refresh information from
// // the upstream service, this can be removed.
// ImportStateVerifyIgnore: []string{"configurable_attribute"},
// },
// // Update and Read testing
// {
// Config: testAccExampleResourceConfig("two"),
// Check: resource.ComposeAggregateTestCheckFunc(
// resource.TestCheckResourceAttr("scaffolding_example.test", "configurable_attribute", "two"),
// ),
// },
// // Delete testing automatically occurs in TestCase
// },
// })
// }

"github.com/cloudflare/terraform-provider-cloudflare/internal/framework/provider"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
)

func TestAccExampleResource(t *testing.T) {
resource.Test(t, resource.TestCase{
PreCheck: func() { provider.TestAccPreCheck(t) },
ProtoV6ProviderFactories: provider.TestAccProtoV6ProviderFactories,
Steps: []resource.TestStep{
// Create and Read testing
{
Config: testAccExampleResourceConfig("one"),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr("scaffolding_example.test", "configurable_attribute", "one"),
resource.TestCheckResourceAttr("scaffolding_example.test", "id", "example-id"),
),
},
// ImportState testing
{
ResourceName: "scaffolding_example.test",
ImportState: true,
ImportStateVerify: true,
// This is not normally necessary, but is here because this
// example code does not have an actual upstream service.
// Once the Read method is able to refresh information from
// the upstream service, this can be removed.
ImportStateVerifyIgnore: []string{"configurable_attribute"},
},
// Update and Read testing
{
Config: testAccExampleResourceConfig("two"),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr("scaffolding_example.test", "configurable_attribute", "two"),
),
},
// Delete testing automatically occurs in TestCase
},
})
}

func testAccExampleResourceConfig(configurableAttribute string) string {
return fmt.Sprintf(`
resource "scaffolding_example" "test" {
configurable_attribute = %[1]q
}
`, configurableAttribute)
}
// func testAccExampleResourceConfig(configurableAttribute string) string {
// return fmt.Sprintf(`
// resource "scaffolding_example" "test" {
// configurable_attribute = %[1]q
// }
// `, configurableAttribute)
// }

0 comments on commit 57c6e27

Please sign in to comment.