Skip to content

Commit

Permalink
update new tests to shimmed
Browse files Browse the repository at this point in the history
  • Loading branch information
jackofallops committed Jan 7, 2021
1 parent e6ded25 commit ca7f945
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 83 deletions.
80 changes: 37 additions & 43 deletions azurerm/internal/services/web/app_service_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -866,55 +866,49 @@ func TestAccAppService_managedPipelineMode(t *testing.T) {
})
}

func TestAccAzureRMAppService_detailedErrorMessagesLogs(t *testing.T) {
func TestAccAppService_detailedErrorMessagesLogs(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_app_service", "test")
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { acceptance.PreCheck(t) },
Providers: acceptance.SupportedProviders,
CheckDestroy: testCheckAzureRMAppServiceDestroy,
Steps: []resource.TestStep{
{
Config: testAccAzureRMAppService_detailedErrorMessagesEnabled(data),
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMAppServiceExists(data.ResourceName),
resource.TestCheckResourceAttr(data.ResourceName, "logs.0.detailed_error_messages_enabled", "true"),
),
},
{
Config: testAccAzureRMAppService_detailedErrorMessagesDisabled(data),
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMAppServiceExists(data.ResourceName),
resource.TestCheckResourceAttr(data.ResourceName, "logs.0.detailed_error_messages_enabled", "false"),
),
},
data.ImportStep(),
r := AppServiceResource{}

data.ResourceTest(t, r, []resource.TestStep{
{
Config: r.detailedErrorMessages(data, true),
Check: resource.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
check.That(data.ResourceName).Key("logs.0.detailed_error_messages_enabled").HasValue("true"),
),
},
{
Config: r.detailedErrorMessages(data, false),
Check: resource.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
resource.TestCheckResourceAttr(data.ResourceName, "logs.0.detailed_error_messages_enabled", "false"),
),
},
data.ImportStep(),
})
}

func TestAccAzureRMAppService_failedRequestTracingLogs(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_app_service", "test")
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { acceptance.PreCheck(t) },
Providers: acceptance.SupportedProviders,
CheckDestroy: testCheckAzureRMAppServiceDestroy,
Steps: []resource.TestStep{
{
Config: testAccAzureRMAppService_failedRequestTracingEnabled(data),
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMAppServiceExists(data.ResourceName),
resource.TestCheckResourceAttr(data.ResourceName, "logs.0.failed_request_tracing_enabled", "true"),
),
},
{
Config: testAccAzureRMAppService_failedRequestTracingDisabled(data),
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMAppServiceExists(data.ResourceName),
resource.TestCheckResourceAttr(data.ResourceName, "logs.0.failed_request_tracing_enabled", "false"),
),
},
data.ImportStep(),
r := AppServiceResource{}

data.ResourceTest(t, r, []resource.TestStep{
{
Config: r.failedRequestTracing(data, true),
Check: resource.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
check.That(data.ResourceName).Key("logs.0.failed_request_tracing_enabled").HasValue("true"),
),
},
{
Config: r.failedRequestTracing(data, false),
Check: resource.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
check.That(data.ResourceName).Key("logs.0.failed_request_tracing_enabled").HasValue("false"),
),
},
data.ImportStep(),
})
}

Expand Down Expand Up @@ -3534,7 +3528,7 @@ resource "azurerm_app_service" "test" {
`, template, data.RandomInteger)
}

func testAccAzureRMAppService_detailedErrorMessages(data acceptance.TestData, detailedErrorEnabled bool) string {
func (r AppServiceResource) detailedErrorMessages(data acceptance.TestData, detailedErrorEnabled bool) string {
return fmt.Sprintf(`
provider "azurerm" {
features {}
Expand Down Expand Up @@ -3569,7 +3563,7 @@ resource "azurerm_app_service" "test" {
`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger, detailedErrorEnabled)
}

func testAccAzureRMAppService_failedRequestTracing(data acceptance.TestData, failedRequestEnabled bool) string {
func (r AppServiceResource) failedRequestTracing(data acceptance.TestData, failedRequestEnabled bool) string {
return fmt.Sprintf(`
provider "azurerm" {
features {}
Expand Down
73 changes: 33 additions & 40 deletions azurerm/internal/services/web/app_service_slot_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1114,51 +1114,44 @@ func TestAccAppServiceSlot_httpBlobStorageLogs(t *testing.T) {

func TestAccAzureRMAppServiceSlot_detailedErrorMessagesLogs(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_app_service_slot", "test")
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { acceptance.PreCheck(t) },
Providers: acceptance.SupportedProviders,
CheckDestroy: testCheckAzureRMAppServiceDestroy,
Steps: []resource.TestStep{
{
Config: testAccAzureRMAppServiceSlot_detailedErrorMessages(data, true),
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMAppServiceExists(data.ResourceName),
),
},
data.ImportStep(),
{
Config: testAccAzureRMAppServiceSlot_detailedErrorMessages(data, false),
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMAppServiceExists(data.ResourceName),
),
},
data.ImportStep(),
r := AppServiceSlotResource{}
data.ResourceTest(t, r, []resource.TestStep{
{
Config: r.detailedErrorMessages(data, true),
Check: resource.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
},
data.ImportStep(),
{
Config: r.detailedErrorMessages(data, false),
Check: resource.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
},
data.ImportStep(),
})
}

func TestAccAzureRMAppServiceSlot_failedRequestTracingLogs(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_app_service_slot", "test")
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { acceptance.PreCheck(t) },
Providers: acceptance.SupportedProviders,
CheckDestroy: testCheckAzureRMAppServiceDestroy,
Steps: []resource.TestStep{
{
Config: testAccAzureRMAppServiceSlot_failedRequestTracing(data, true),
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMAppServiceExists(data.ResourceName),
),
},
data.ImportStep(),
{
Config: testAccAzureRMAppServiceSlot_failedRequestTracing(data, false),
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMAppServiceExists(data.ResourceName),
),
},
data.ImportStep(),
r := AppServiceSlotResource{}

data.ResourceTest(t, r, []resource.TestStep{
{
Config: r.failedRequestTracing(data, true),
Check: resource.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
},
data.ImportStep(),
{
Config: r.failedRequestTracing(data, false),
Check: resource.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
},
data.ImportStep(),
})
}

Expand Down Expand Up @@ -3546,7 +3539,7 @@ resource "azurerm_app_service_slot" "test" {
`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger, data.RandomInteger)
}

func testAccAzureRMAppServiceSlot_detailedErrorMessages(data acceptance.TestData, detailedErrorEnabled bool) string {
func (r AppServiceSlotResource) detailedErrorMessages(data acceptance.TestData, detailedErrorEnabled bool) string {
return fmt.Sprintf(`
provider "azurerm" {
features {}
Expand Down Expand Up @@ -3589,7 +3582,7 @@ resource "azurerm_app_service_slot" "test" {
`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger, data.RandomInteger, detailedErrorEnabled)
}

func testAccAzureRMAppServiceSlot_failedRequestTracing(data acceptance.TestData, failedRequestEnabled bool) string {
func (r AppServiceSlotResource) failedRequestTracing(data acceptance.TestData, failedRequestEnabled bool) string {
return fmt.Sprintf(`
provider "azurerm" {
features {}
Expand Down

0 comments on commit ca7f945

Please sign in to comment.