Skip to content

Commit

Permalink
Renamed tests func and change description of ignore_below
Browse files Browse the repository at this point in the history
  • Loading branch information
jsonroy-fastly committed May 7, 2024
1 parent 330024a commit 266b6ca
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 19 deletions.
24 changes: 9 additions & 15 deletions fastly/resource_fastly_alert.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func resourceFastlyAlert() *schema.Resource {
"ignore_below": {
Type: schema.TypeFloat,
Optional: true,
Description: "Floor noise that can be configured to ignore data points that are below this threshold.",
Description: "Threshold for the denominator value used in evaluations that calculate a rate or ratio. Usually used to filter out noise.",
},
"period": {
Type: schema.TypeString,
Expand Down Expand Up @@ -296,25 +296,19 @@ func buildDimensions(data map[string][]string, v map[string]any) map[string][]st
}

func buildEvaluationStrategy(v map[string]any) map[string]any {
evaluationStrategy := map[string]any{}

if value, ok := v["type"]; ok {
evaluationStrategy["type"] = value.(string)
}

if value, ok := v["period"]; ok {
evaluationStrategy["period"] = value.(string)
}

if value, ok := v["threshold"]; ok {
evaluationStrategy["threshold"] = value.(float64)
// Required attributes
m := map[string]any{
"type": v["type"].(string),
"period": v["period"].(string),
"threshold": v["threshold"].(float64),
}

// Optional attributes
if value, ok := v["ignore_below"]; ok {
evaluationStrategy["ignore_below"] = value.(float64)
m["ignore_below"] = value.(float64)
}

return evaluationStrategy
return m
}

func buildStringSlice(s *schema.Set) []string {
Expand Down
8 changes: 4 additions & 4 deletions fastly/resource_fastly_alert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
)

func TestAccFastlyAlert_basic(t *testing.T) {
func TestAccFastlyAlertBasic(t *testing.T) {

Check failure on line 15 in fastly/resource_fastly_alert_test.go

View workflow job for this annotation

GitHub Actions / lint

AT003: acceptance test function name should include underscore
var service gofastly.ServiceDetail
serviceName := fmt.Sprintf("tf-test-%s", acctest.RandString(10))
domainName := fmt.Sprintf("fastly-test.tf-%s.com", acctest.RandString(10))
Expand Down Expand Up @@ -75,7 +75,7 @@ func TestAccFastlyAlert_basic(t *testing.T) {
})
}

func TestAccFastlyAlert_basic_stats(t *testing.T) {
func TestAccFastlyAlertBasicStats(t *testing.T) {

Check failure on line 78 in fastly/resource_fastly_alert_test.go

View workflow job for this annotation

GitHub Actions / lint

AT003: acceptance test function name should include underscore
var service gofastly.ServiceDetail
serviceName := fmt.Sprintf("tf-test-%s", acctest.RandString(10))
domainName := fmt.Sprintf("fastly-test.tf-%s.com", acctest.RandString(10))
Expand Down Expand Up @@ -134,7 +134,7 @@ func TestAccFastlyAlert_basic_stats(t *testing.T) {
})
}

func TestAccFastlyAlert_basic_stats_aggregate(t *testing.T) {
func TestAccFastlyAlertBasicStatsAggregate(t *testing.T) {

Check failure on line 137 in fastly/resource_fastly_alert_test.go

View workflow job for this annotation

GitHub Actions / lint

AT003: acceptance test function name should include underscore
service := gofastly.ServiceDetail{
Name: gofastly.ToPointer(""),
ServiceID: gofastly.ToPointer(""),
Expand Down Expand Up @@ -193,7 +193,7 @@ func TestAccFastlyAlert_basic_stats_aggregate(t *testing.T) {
})
}

func TestAccFastlyAlert_basic_stats_aggregate_percent(t *testing.T) {
func TestAccFastlyAlertBasicStatsAggregatePercent(t *testing.T) {

Check failure on line 196 in fastly/resource_fastly_alert_test.go

View workflow job for this annotation

GitHub Actions / lint

AT003: acceptance test function name should include underscore
service := gofastly.ServiceDetail{
Name: gofastly.ToPointer(""),
ServiceID: gofastly.ToPointer(""),
Expand Down

0 comments on commit 266b6ca

Please sign in to comment.