Skip to content

Commit 3a7ba6a

Browse files
author
Abhishek Singh
committed
SUMO-266317: Fixing Test case
1 parent e556c1b commit 3a7ba6a

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

sumologic/resource_sumologic_role_v2_test.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -218,11 +218,11 @@ resource "sumologic_role_v2" "test" {
218218
`, name, auditDataFilter, selectionType, capabilities, description, securityDataFilter, logAnalyticsFilter)
219219
}
220220

221-
func TestAccSumologicRoleV2_selectionTypeOptional(t *testing.T) {
221+
func TestAccSumologicRoleV2_selectionType_DefaultsToAll(t *testing.T) {
222222
var roleV2 RoleV2
223223
testName := acctest.RandomWithPrefix("tf-acc-test")
224224
testCapabilities := []string{"\"manageContent\""}
225-
testDescription := "Role with optional selection_type"
225+
testDescription := "Role with default selection_type"
226226
testAuditDataFilter := "info"
227227
testSecurityDataFilter := "error"
228228
testLogAnalyticsFilter := "!_sourceCategory=collector"
@@ -232,7 +232,6 @@ func TestAccSumologicRoleV2_selectionTypeOptional(t *testing.T) {
232232
Providers: testAccProviders,
233233
CheckDestroy: testAccCheckRoleV2Destroy(roleV2),
234234
Steps: []resource.TestStep{
235-
// Step 1: selection_type is not set at all
236235
{
237236
Config: fmt.Sprintf(`
238237
resource "sumologic_role_v2" "test" {
@@ -246,10 +245,9 @@ resource "sumologic_role_v2" "test" {
246245
`, testName, testAuditDataFilter, testCapabilities, testDescription, testSecurityDataFilter, testLogAnalyticsFilter),
247246
Check: resource.ComposeTestCheckFunc(
248247
testAccCheckRoleV2Exists("sumologic_role_v2.test", &roleV2, t),
249-
resource.TestCheckResourceAttr("sumologic_role_v2.test", "selection_type", ""),
248+
resource.TestCheckResourceAttr("sumologic_role_v2.test", "selection_type", "All"),
250249
),
251250
},
252-
// Step 2: Explicitly set selection_type = ""
253251
{
254252
Config: fmt.Sprintf(`
255253
resource "sumologic_role_v2" "test" {
@@ -264,7 +262,8 @@ resource "sumologic_role_v2" "test" {
264262
`, testName, testAuditDataFilter, testCapabilities, testDescription, testSecurityDataFilter, testLogAnalyticsFilter),
265263
Check: resource.ComposeTestCheckFunc(
266264
testAccCheckRoleV2Exists("sumologic_role_v2.test", &roleV2, t),
267-
resource.TestCheckResourceAttr("sumologic_role_v2.test", "selection_type", ""),
265+
// Even if user sets "", internally defaults to "All"
266+
resource.TestCheckResourceAttr("sumologic_role_v2.test", "selection_type", "All"),
268267
),
269268
},
270269
},

0 commit comments

Comments
 (0)