Skip to content

Commit b8254ce

Browse files
committed
Update acceptance test for domain field
1 parent 2fb655e commit b8254ce

File tree

1 file changed

+23
-12
lines changed

1 file changed

+23
-12
lines changed

sumologic/resource_sumologic_dashboard_test.go

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func TestAccSumologicDashboard_create(t *testing.T) {
5050
description := "Test dashboard description"
5151
theme := "Dark"
5252
refreshInterval := 120
53-
// domain := "aws"
53+
domain := "aws"
5454
literalRangeName := "today"
5555
textPanel := TextPanel{
5656
Key: "text-panel-001",
@@ -85,7 +85,7 @@ func TestAccSumologicDashboard_create(t *testing.T) {
8585
Steps: []resource.TestStep{
8686
{
8787
Config: dashboardCreateConfig(title, description, theme, refreshInterval,
88-
topologyLabel, literalRangeName, textPanel, layout, variable),
88+
topologyLabel, domain, literalRangeName, textPanel, layout, variable),
8989
Check: resource.ComposeTestCheckFunc(
9090
testAccCheckDashboardExists("sumologic_dashboard.tf_crud_test", &dashboard, t),
9191
resource.TestCheckResourceAttr("sumologic_dashboard.tf_crud_test",
@@ -98,6 +98,8 @@ func TestAccSumologicDashboard_create(t *testing.T) {
9898
"theme", theme),
9999
resource.TestCheckResourceAttr("sumologic_dashboard.tf_crud_test",
100100
"topology_label_map.0.data.#", "2"),
101+
resource.TestCheckResourceAttr("sumologic_dashboard.tf_crud_test",
102+
"domain", domain),
101103
resource.TestCheckResourceAttr("sumologic_dashboard.tf_crud_test",
102104
"time_range.#", "1"),
103105
resource.TestCheckResourceAttr("sumologic_dashboard.tf_crud_test",
@@ -130,6 +132,7 @@ func TestAccSumologicDashboard_update(t *testing.T) {
130132
description := "Test dashboard description"
131133
theme := "Dark"
132134
refreshInterval := 120
135+
domain := "aws"
133136
literalRangeName := "today"
134137
textPanel := TextPanel{
135138
Key: "text-panel-001",
@@ -160,6 +163,7 @@ func TestAccSumologicDashboard_update(t *testing.T) {
160163
newTheme := "Light"
161164
newRefreshInterval := 300
162165
newFirstLabelValue := "collection-cluster"
166+
updatedDomain := "app"
163167
newLiteralRangeName := "week"
164168
searchPanel := SumoSearchPanel{
165169
Key: "search-panel-001",
@@ -211,7 +215,7 @@ func TestAccSumologicDashboard_update(t *testing.T) {
211215
Steps: []resource.TestStep{
212216
{
213217
Config: dashboardCreateConfig(title, description, theme, refreshInterval,
214-
topologyLabel, literalRangeName, textPanel, layout, csvVariable),
218+
topologyLabel, domain, literalRangeName, textPanel, layout, csvVariable),
215219
Check: resource.ComposeTestCheckFunc(
216220
testAccCheckDashboardExists("sumologic_dashboard.tf_crud_test", &dashboard, t),
217221
resource.TestCheckResourceAttr("sumologic_dashboard.tf_crud_test",
@@ -222,6 +226,8 @@ func TestAccSumologicDashboard_update(t *testing.T) {
222226
"theme", theme),
223227
resource.TestCheckResourceAttr("sumologic_dashboard.tf_crud_test",
224228
"topology_label_map.0.data.#", "2"),
229+
resource.TestCheckResourceAttr("sumologic_dashboard.tf_crud_test",
230+
"domain", domain),
225231
resource.TestCheckResourceAttr("sumologic_dashboard.tf_crud_test",
226232
"time_range.0.begin_bounded_time_range.0.from.0.literal_time_range.0.range_name",
227233
literalRangeName),
@@ -241,8 +247,8 @@ func TestAccSumologicDashboard_update(t *testing.T) {
241247
},
242248
{
243249
Config: dashboardUpdateConfig(title, description, newTheme, newRefreshInterval,
244-
firstLabelKey, newFirstLabelValue, newLiteralRangeName, textPanel, searchPanel,
245-
newLayout, newVariables),
250+
firstLabelKey, newFirstLabelValue, updatedDomain, newLiteralRangeName, textPanel,
251+
searchPanel, newLayout, newVariables),
246252
Check: resource.ComposeTestCheckFunc(
247253
testAccCheckDashboardExists("sumologic_dashboard.tf_crud_test", &dashboard, t),
248254
resource.TestCheckResourceAttr("sumologic_dashboard.tf_crud_test",
@@ -253,6 +259,8 @@ func TestAccSumologicDashboard_update(t *testing.T) {
253259
"theme", newTheme),
254260
resource.TestCheckResourceAttr("sumologic_dashboard.tf_crud_test",
255261
"topology_label_map.0.data.#", "1"),
262+
resource.TestCheckResourceAttr("sumologic_dashboard.tf_crud_test",
263+
"domain", updatedDomain),
256264
resource.TestCheckResourceAttr("sumologic_dashboard.tf_crud_test",
257265
"time_range.0.begin_bounded_time_range.0.from.0.literal_time_range.0.range_name",
258266
newLiteralRangeName),
@@ -395,8 +403,8 @@ func dashboardImportConfig(title string) string {
395403
}
396404

397405
func dashboardCreateConfig(title string, description string, theme string, refreshInterval int,
398-
topologyLabel TopologyLabel, rangeName string, textPanel TextPanel, layout GridLayout,
399-
variable Variable) string {
406+
topologyLabel TopologyLabel, domain string, rangeName string, textPanel TextPanel,
407+
layout GridLayout, variable Variable) string {
400408

401409
return fmt.Sprintf(`
402410
data "sumologic_personal_folder" "personalFolder" {}
@@ -416,6 +424,7 @@ func dashboardCreateConfig(title string, description string, theme string, refre
416424
values = ["%s", "%s"]
417425
}
418426
}
427+
domain = "%s"
419428
time_range {
420429
begin_bounded_time_range {
421430
from {
@@ -458,15 +467,16 @@ func dashboardCreateConfig(title string, description string, theme string, refre
458467
}`,
459468
title, description, refreshInterval, theme, firstLabelKey, topologyLabel.Data[firstLabelKey][0],
460469
secondLabelKey, topologyLabel.Data[secondLabelKey][0], topologyLabel.Data[secondLabelKey][1],
461-
rangeName, textPanel.Key, textPanel.Title, textPanel.Text,
470+
domain, rangeName, textPanel.Key, textPanel.Title, textPanel.Text,
462471
layout.LayoutStructures[0].Key, variable.Name, variable.DisplayName, variable.DefaultValue,
463472
variable.SourceDefinition.(CsvVariableSourceDefinition).Values,
464473
)
465474
}
466475

467476
func dashboardUpdateConfig(title string, description string, theme string, refreshInterval int,
468-
topologyLabel string, topologyLabelValue string, rangeName string, textPanel TextPanel,
469-
searchPanel SumoSearchPanel, layout GridLayout, variables []Variable) string {
477+
topologyLabel string, topologyLabelValue string, domain string, rangeName string,
478+
textPanel TextPanel, searchPanel SumoSearchPanel, layout GridLayout,
479+
variables []Variable) string {
470480

471481
loqQuerySourceDef := variables[1].SourceDefinition.(LogQueryVariableSourceDefinition)
472482
csvSourceDef := variables[0].SourceDefinition.(CsvVariableSourceDefinition)
@@ -485,6 +495,7 @@ func dashboardUpdateConfig(title string, description string, theme string, refre
485495
values = ["%s"]
486496
}
487497
}
498+
domain = "%s"
488499
time_range {
489500
begin_bounded_time_range {
490501
from {
@@ -567,8 +578,8 @@ func dashboardUpdateConfig(title string, description string, theme string, refre
567578
hide_from_ui = false
568579
}
569580
}`,
570-
title, description, refreshInterval, theme, topologyLabel, topologyLabelValue, rangeName,
571-
textPanel.Key, textPanel.Title, textPanel.Text,
581+
title, description, refreshInterval, theme, topologyLabel, topologyLabelValue, domain,
582+
rangeName, textPanel.Key, textPanel.Title, textPanel.Text,
572583
searchPanel.Key, searchPanel.Title, searchPanel.Description, searchPanel.Queries[0].QueryString,
573584
searchPanel.Queries[0].QueryKey,
574585
layout.LayoutStructures[0].Key, layout.LayoutStructures[1].Key,

0 commit comments

Comments
 (0)