mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-10-03 01:01:06 +00:00
54 lines
1.2 KiB
Go
54 lines
1.2 KiB
Go
|
package google
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"testing"
|
||
|
|
||
|
"github.com/hashicorp/terraform/helper/acctest"
|
||
|
"github.com/hashicorp/terraform/helper/resource"
|
||
|
)
|
||
|
|
||
|
func TestAccLoggingMetric_update(t *testing.T) {
|
||
|
t.Parallel()
|
||
|
|
||
|
suffix := acctest.RandString(10)
|
||
|
filter := "resource.type=gae_app AND severity>=ERROR"
|
||
|
updatedFilter := "resource.type=gae_app AND severity=ERROR"
|
||
|
|
||
|
resource.Test(t, resource.TestCase{
|
||
|
PreCheck: func() { testAccPreCheck(t) },
|
||
|
Providers: testAccProviders,
|
||
|
CheckDestroy: testAccCheckLoggingMetricDestroy,
|
||
|
Steps: []resource.TestStep{
|
||
|
{
|
||
|
Config: testAccLoggingMetric_update(suffix, filter),
|
||
|
},
|
||
|
{
|
||
|
ResourceName: "google_logging_metric.logging_metric",
|
||
|
ImportState: true,
|
||
|
ImportStateVerify: true,
|
||
|
},
|
||
|
{
|
||
|
Config: testAccLoggingMetric_update(suffix, updatedFilter),
|
||
|
},
|
||
|
{
|
||
|
ResourceName: "google_logging_metric.logging_metric",
|
||
|
ImportState: true,
|
||
|
ImportStateVerify: true,
|
||
|
},
|
||
|
},
|
||
|
})
|
||
|
}
|
||
|
|
||
|
func testAccLoggingMetric_update(suffix string, filter string) string {
|
||
|
return fmt.Sprintf(`
|
||
|
resource "google_logging_metric" "logging_metric" {
|
||
|
name = "my-custom-metric-%s"
|
||
|
filter = "%s"
|
||
|
metric_descriptor {
|
||
|
metric_kind = "DELTA"
|
||
|
value_type = "INT64"
|
||
|
}
|
||
|
}`, suffix, filter)
|
||
|
}
|