Skip to content

Commit

Permalink
Added new test
Browse files Browse the repository at this point in the history
Added the volume test
Fixed test for domain and domain record

Signed-off-by: Alejandro JNM <alejandrojnm@gmail.com>
  • Loading branch information
alejandrojnm committed Jul 3, 2020
1 parent 102a5b2 commit 91509d2
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 2 deletions.
2 changes: 1 addition & 1 deletion civo/datasource_dns_domain_name_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ func TestAccDataSourceCivoDnsDomainName(t *testing.T) {
datasourceName := "data.civo_dns_domain_name.domain"
domain := acctest.RandomWithPrefix("domian") + ".com"

resource.ParallelTest(t, resource.TestCase{
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
Steps: []resource.TestStep{
Expand Down
2 changes: 1 addition & 1 deletion civo/datasource_dns_domain_record_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ func TestAccDataSourceCivoDNSDomainRecord_basic(t *testing.T) {
datasourceName := "data.civo_dns_domain_record.record"
domain := acctest.RandomWithPrefix("recordtest") + ".com"

resource.ParallelTest(t, resource.TestCase{
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
Steps: []resource.TestStep{
Expand Down
41 changes: 41 additions & 0 deletions civo/datasource_volume_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package civo

import (
"fmt"
"testing"

"github.com/hashicorp/terraform-plugin-sdk/helper/acctest"
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
)

func TestAccDataSourceCivoVolume_basic(t *testing.T) {
datasourceName := "data.civo_volume.foobar"
name := acctest.RandomWithPrefix("ds-test")

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: testAccDataSourceCivoVolumeConfig(name),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr(datasourceName, "name", name),
),
},
},
})
}

func testAccDataSourceCivoVolumeConfig(name string) string {
return fmt.Sprintf(`
resource "civo_volume" "foobar" {
name = "%s"
size_gb = 60
bootable = false
}
data "civo_volume" "foobar" {
name = civo_volume.foobar.name
}
`, name)
}

0 comments on commit 91509d2

Please sign in to comment.