Skip to content

Commit

Permalink
fix: PC-11815 terraform tests fix (#229)
Browse files Browse the repository at this point in the history
## Motivation

fixing the following errors


![image](https://github.com/nobl9/terraform-provider-nobl9/assets/696884/0602b98b-5d70-4da9-881a-3855a8f4826f)

Co-authored-by: kubaceg <jakub.cegielka@nobl9.com>
  • Loading branch information
kubaceg and kubaceg committed May 15, 2024
1 parent 41cde93 commit 697463f
Showing 1 changed file with 27 additions and 16 deletions.
43 changes: 27 additions & 16 deletions nobl9/resource_budgetadjustment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,46 +35,57 @@ func TestAcc_Nobl9BudgetAdjustments(t *testing.T) {
}

func testBudgetAdjustmentSingleEvent(name string) string {
return fmt.Sprintf(`
const sloName = "test-slo"
return testPrometheusSLOFull(sloName) +
fmt.Sprintf(`
resource "nobl9_budget_adjustment" "%s" {
name = "%s"
first_event_start = "2022-01-01T00:00:00Z"
duration = "1h"
filters {
slos {
slo {
name = "cloudwatch-ratio-slo"
project = "cloudwatch"
name = nobl9_slo.%s.name
project = "%s"
}
}
}
}
`, name, name)
`, name, name, sloName, testProject)
}

func testBudgetAdjustmentRecurringEvent(name string) string {
return fmt.Sprintf(`resource "nobl9_budget_adjustment" "%s" {
const sloName = "test-slo2"
const sloName2 = "test-slo3"

return testPrometheusSLOFull(sloName) + testPrometheusSLOFull(sloName2) +
fmt.Sprintf(`
resource "nobl9_budget_adjustment" "%s" {
name = "%s"
first_event_start = "2022-01-01T00:00:00Z"
duration = "1h"
rrule = "FREQ=MONTHLY;BYMONTHDAY=1"
filters {
slos {
slo {
name = "cloudwatch-ratio-slo"
project = "cloudwatch"
name = nobl9_slo.%s.name
project = "%s"
}
slo {
name = "cloudwatch-ratio-slo2"
project = "cloudwatch"
name = nobl9_slo.%s.name
project = "%s"
}
}
}
}`, name, name)
}`, name, name, sloName, testProject, sloName2, testProject)
}

func testBudgetAdjustmentRecurringEventMultipleSlo(name string) string {
return fmt.Sprintf(`
const sloName = "test-slo4"
const sloName2 = "test-slo5"

return testPrometheusSLOFull(sloName) + testPrometheusSLOFull(sloName2) +
fmt.Sprintf(`
resource "nobl9_budget_adjustment" "%s" {
name = "%s"
display_name = "Recurring budget adjustment for the first day of the month."
Expand All @@ -85,15 +96,15 @@ resource "nobl9_budget_adjustment" "%s" {
filters {
slos {
slo {
name = "ratio-slo"
project = "default"
name = nobl9_slo.%s.name
project = "%s"
}
slo {
name = "ratio-slo-timeslices"
project = "default"
name = nobl9_slo.%s.name
project = "%s"
}
}
}
}
`, name, name)
`, name, name, sloName, testProject, sloName2, testProject)
}

0 comments on commit 697463f

Please sign in to comment.