Skip to content

Commit

Permalink
fix(swo_website): Fix acceptance test for website resource (#90)
Browse files Browse the repository at this point in the history
* website acctest. Fix titles, urls, and computed values

* adding back location options
  • Loading branch information
michael-anderson-swi authored Sep 4, 2024
1 parent 66f7efd commit c0bd48d
Showing 1 changed file with 16 additions and 19 deletions.
35 changes: 16 additions & 19 deletions internal/provider/website_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ func TestAccWebsiteResource(t *testing.T) {
Config: testAccWebsiteResourceConfig("test-acc test one"),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttrSet("swo_website.test", "id"),
resource.TestCheckResourceAttr("swo_website.test", "name", "test one"),
resource.TestCheckResourceAttr("swo_website.test", "url", "www.solarwinds.com"),
resource.TestCheckResourceAttr("swo_website.test", "name", "test-acc test one"),
resource.TestCheckResourceAttr("swo_website.test", "url", "https://example.com"),
),
},
{
Config: testAccWebsiteResourceConfigWithoutOptionals("test create without"),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttrSet("swo_website.test", "id"),
resource.TestCheckResourceAttr("swo_website.test", "name", "test create without"),
resource.TestCheckResourceAttr("swo_website.test", "url", "www.solarwinds.com"),
resource.TestCheckResourceAttr("swo_website.test", "url", "https://solarwinds.com"),
),
},
// ImportState testing
Expand All @@ -40,13 +40,13 @@ func TestAccWebsiteResource(t *testing.T) {
{
Config: testAccWebsiteResourceConfig("test-acc test two"),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr("swo_website.test", "name", "test two"),
resource.TestCheckResourceAttr("swo_website.test", "name", "test-acc test two"),
),
},
{
Config: testAccWebsiteResourceConfigWithoutOptionals("test update without"),
Config: testAccWebsiteResourceConfigWithoutOptionals("test-acc test update without"),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr("swo_website.test", "name", "test update without"),
resource.TestCheckResourceAttr("swo_website.test", "name", "test-acc test update without"),
),
},
// Delete testing automatically occurs in TestCase
Expand All @@ -56,16 +56,11 @@ func TestAccWebsiteResource(t *testing.T) {

func testAccWebsiteResourceConfig(name string) string {
return providerConfig() + fmt.Sprintf(`
resource "swo_website" "test_website" {
resource "swo_website" "test" {
name = %[1]q
url = "https://example.com"
monitoring = {
options = {
is_availability_active = true
is_rum_active = true
}
availability = {
check_for_string = {
operator = "CONTAINS"
Expand Down Expand Up @@ -128,16 +123,12 @@ func testAccWebsiteResourceConfig(name string) string {

func testAccWebsiteResourceConfigWithoutOptionals(name string) string {
return providerConfig() + fmt.Sprintf(`
resource "swo_website" "test_website" {
resource "swo_website" "test" {
name = %[1]q
url = "https://example.com"
url = "https://solarwinds.com"
monitoring = {
options = {
is_availability_active = true
is_rum_active = true
}
availability = {
protocols = ["HTTP", "HTTPS"]
Expand Down Expand Up @@ -167,6 +158,12 @@ func testAccWebsiteResourceConfigWithoutOptionals(name string) string {
test_from_all = false
platforms = ["AWS"]
}
ssl = {
days_prior_to_expiration = 30
enabled = false
ignore_intermediate_certificates = false
}
}
rum = {
Expand Down

0 comments on commit c0bd48d

Please sign in to comment.