Skip to content

Commit 8fb64bd

Browse files
author
Sean Sain
committed
validate json
1 parent c10f866 commit 8fb64bd

File tree

1 file changed

+81
-5
lines changed

1 file changed

+81
-5
lines changed

sumologic/resource_sumologic_content_test.go

Lines changed: 81 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,87 @@ func testAccCheckContentDestroy(s *terraform.State) error {
129129
return nil
130130
}
131131

132-
var updateConfigJson = `{"type":"SavedSearchWithScheduleSyncDefinition","name":"test-333","search":{"queryText":"\"warn\"","defaultTimeRange":"-15m","byReceiptTime":false,"viewName":"","viewStartTime":"1970-01-01T00:00:00Z","queryParameters":[],"parsingMode":"Manual"},"searchSchedule":{"cronExpression":"0 0 * * * ? *","displayableTimeRange":"-10m","parseableTimeRange":{"type":"BeginBoundedTimeRange","from":{"type":"RelativeTimeRangeBoundary","relativeTime":"-50m"},"to":null},"timeZone":"America/Los_Angeles","threshold":null,"notification":{"taskType":"EmailSearchNotificationSyncDefinition","toList":["[email protected]"],"subjectTemplate":"Search Results: {{SearchName}}","includeQuery":true,"includeResultSet":true,"includeHistogram":false,"includeCsvAttachment":false},"scheduleType":"1Hour","muteErrorEmails":false,"parameters":[]},"description":"Runs every hour with timerange of 15m and sends email notifications"}
133-
`
134-
135-
var configJson = `{"type":"SavedSearchWithScheduleSyncDefinition","name":"test-121","search":{"queryText":"\"error\"","defaultTimeRange":"-15m","byReceiptTime":false,"viewName":"","viewStartTime":"1970-01-01T00:00:00Z","queryParameters":[],"parsingMode":"Manual"},"searchSchedule":{"cronExpression":"0 0 * * * ? *","displayableTimeRange":"-10m","parseableTimeRange":{"type":"BeginBoundedTimeRange","from":{"type":"RelativeTimeRangeBoundary","relativeTime":"-50m"},"to":null},"timeZone":"America/Los_Angeles","threshold":null,"notification":{"taskType":"EmailSearchNotificationSyncDefinition","toList":["[email protected]"],"subjectTemplate":"Search Results: {{SearchName}}","includeQuery":true,"includeResultSet":true,"includeHistogram":false,"includeCsvAttachment":false},"scheduleType":"1Hour","muteErrorEmails":false,"parameters":[]},"description":"Runs every hour with timerange of 15m and sends email notifications"}
136-
`
132+
var updateConfigJson = `{
133+
"type": "SavedSearchWithScheduleSyncDefinition",
134+
"name": "test-333",
135+
"search": {
136+
"queryText": "\"warn\"",
137+
"defaultTimeRange": "-15m",
138+
"byReceiptTime": false,
139+
"viewName": "",
140+
"viewStartTime": "1970-01-01T00:00:00Z",
141+
"queryParameters": [],
142+
"parsingMode": "Manual"
143+
},
144+
"searchSchedule": {
145+
"cronExpression": "0 0 * * * ? *",
146+
"displayableTimeRange": "-10m",
147+
"parseableTimeRange": {
148+
"type": "BeginBoundedTimeRange",
149+
"from": {
150+
"type": "RelativeTimeRangeBoundary",
151+
"relativeTime": "-50m"
152+
},
153+
"to": null
154+
},
155+
"timeZone": "America/Los_Angeles",
156+
"threshold": null,
157+
"notification": {
158+
"taskType": "EmailSearchNotificationSyncDefinition",
159+
"toList": ["[email protected]"],
160+
"subjectTemplate": "Search Results: {{SearchName}}",
161+
"includeQuery": true,
162+
"includeResultSet": true,
163+
"includeHistogram": false,
164+
"includeCsvAttachment": false
165+
},
166+
"scheduleType": "1Hour",
167+
"muteErrorEmails": false,
168+
"parameters": []
169+
},
170+
"description": "Runs every hour with timerange of 15m and sends email notifications"
171+
}`
172+
173+
var configJson = `{
174+
"type": "SavedSearchWithScheduleSyncDefinition",
175+
"name": "test-121",
176+
"search": {
177+
"queryText": "\"error\"",
178+
"defaultTimeRange": "-15m",
179+
"byReceiptTime": false,
180+
"viewName": "",
181+
"viewStartTime": "1970-01-01T00:00:00Z",
182+
"queryParameters": [],
183+
"parsingMode": "Manual"
184+
},
185+
"searchSchedule": {
186+
"cronExpression": "0 0 * * * ? *",
187+
"displayableTimeRange": "-10m",
188+
"parseableTimeRange": {
189+
"type": "BeginBoundedTimeRange",
190+
"from": {
191+
"type": "RelativeTimeRangeBoundary",
192+
"relativeTime": "-50m"
193+
},
194+
"to": null
195+
},
196+
"timeZone": "America/Los_Angeles",
197+
"threshold": null,
198+
"notification": {
199+
"taskType": "EmailSearchNotificationSyncDefinition",
200+
"toList": ["[email protected]"],
201+
"subjectTemplate": "Search Results: {{SearchName}}",
202+
"includeQuery": true,
203+
"includeResultSet": true,
204+
"includeHistogram": false,
205+
"includeCsvAttachment": false
206+
},
207+
"scheduleType": "1Hour",
208+
"muteErrorEmails": false,
209+
"parameters": []
210+
},
211+
"description": "Runs every hour with timerange of 15m and sends email notifications"
212+
}`
137213

138214
func testAccSumologicContent(parentId string, configJson string) string {
139215
return fmt.Sprintf(`

0 commit comments

Comments
 (0)