2019-08-16 19:43:15 +00:00
|
|
|
package rule_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2019-09-05 22:32:28 +00:00
|
|
|
"github.com/influxdata/influxdb"
|
2019-08-16 19:43:15 +00:00
|
|
|
"github.com/influxdata/influxdb/notification"
|
2019-08-27 17:29:49 +00:00
|
|
|
"github.com/influxdata/influxdb/notification/endpoint"
|
2019-08-16 19:43:15 +00:00
|
|
|
"github.com/influxdata/influxdb/notification/rule"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestHTTP_GenerateFlux(t *testing.T) {
|
|
|
|
want := `package main
|
|
|
|
// foo
|
2019-08-23 21:46:03 +00:00
|
|
|
import "influxdata/influxdb/monitor"
|
2019-08-16 19:43:15 +00:00
|
|
|
import "http"
|
2019-08-19 11:31:46 +00:00
|
|
|
import "json"
|
2019-09-03 20:58:50 +00:00
|
|
|
import "experimental"
|
2019-08-16 19:43:15 +00:00
|
|
|
|
2019-09-05 00:37:22 +00:00
|
|
|
option task = {name: "foo", every: 1h, offset: 1s}
|
2019-08-16 19:43:15 +00:00
|
|
|
|
2019-09-05 22:32:28 +00:00
|
|
|
headers = {"Content-Type": "application/json"}
|
2019-08-19 11:31:46 +00:00
|
|
|
endpoint = http.endpoint(url: "http://localhost:7777")
|
|
|
|
notification = {
|
|
|
|
_notification_rule_id: "0000000000000001",
|
|
|
|
_notification_rule_name: "foo",
|
|
|
|
_notification_endpoint_id: "0000000000000002",
|
2019-08-27 17:29:49 +00:00
|
|
|
_notification_endpoint_name: "foo",
|
2019-08-19 11:31:46 +00:00
|
|
|
}
|
2019-09-05 13:52:05 +00:00
|
|
|
statuses = monitor.from(start: -2h)
|
2019-09-05 14:30:11 +00:00
|
|
|
crit = statuses
|
|
|
|
|> filter(fn: (r) =>
|
|
|
|
(r._level == "crit"))
|
|
|
|
all_statuses = crit
|
2019-09-03 20:58:50 +00:00
|
|
|
|> filter(fn: (r) =>
|
|
|
|
(r._time > experimental.subDuration(from: now(), d: 1h)))
|
2019-08-16 19:43:15 +00:00
|
|
|
|
2019-09-03 20:58:50 +00:00
|
|
|
all_statuses
|
feat(notification/rule): add JSON body for the HTTP POST (#14994)
The body of the JSON webhook would be:
{
"version": 1,
"rule_name": notification._notification_rule_name,
"rule_id": notification._notification_rule_id,
"endpoint_name": notification._notification_endpoint_name,
"endpoint_id": notification._notification_endpoint_id,
"check_name": r._check_name,
"check_id": r._check_id,
"check_type": r._type,
"source_measurement": r._source_measurement,
"source_timestamp": r._source_timestamp,
"level": r._level,
"message": r._message,
}
2019-09-06 01:38:02 +00:00
|
|
|
|> monitor.notify(data: notification, endpoint: endpoint(mapFn: (r) => {
|
feat(notification/rule): add _version: 1 to HTTP body (#15028)
This adds the _version: 1 correctly to the body of the HTTP POST.
Additionally, this fixes the imports when using secrets.
The POSTed JSON body now is:
```json
{
"_check_id": "046cac59e2aa3000",
"_check_name": "High CPU User Usage",
"_level": "crit",
"_measurement": "notifications",
"_message": "High CPU User Usage: rsavage.prod is crit",
"_notification_endpoint_id": "046cad0c83aec000",
"_notification_endpoint_name": "HTTP Endpoint",
"_notification_rule_id": "046dff53d4183000",
"_notification_rule_name": "HTTP Notification",
"_source_measurement": "cpu",
"_source_timestamp": 1567797375000000000,
"_start": "2019-09-06T19:15:59Z",
"_status_timestamp": 1567797376416632300,
"_stop": "2019-09-06T19:16:20.362006739Z",
"_time": "2019-09-06T19:16:20.609629338Z",
"_type": "threshold",
"_version": 1,
"cpu": "cpu-total",
"host": "rsavage.prod",
"usage_user": 91.12278069517379
}
```
2019-09-06 21:21:27 +00:00
|
|
|
body = {r with _version: 1}
|
feat(notification/rule): add JSON body for the HTTP POST (#14994)
The body of the JSON webhook would be:
{
"version": 1,
"rule_name": notification._notification_rule_name,
"rule_id": notification._notification_rule_id,
"endpoint_name": notification._notification_endpoint_name,
"endpoint_id": notification._notification_endpoint_id,
"check_name": r._check_name,
"check_id": r._check_id,
"check_type": r._type,
"source_measurement": r._source_measurement,
"source_timestamp": r._source_timestamp,
"level": r._level,
"message": r._message,
}
2019-09-06 01:38:02 +00:00
|
|
|
|
feat(notification/rule): add _version: 1 to HTTP body (#15028)
This adds the _version: 1 correctly to the body of the HTTP POST.
Additionally, this fixes the imports when using secrets.
The POSTed JSON body now is:
```json
{
"_check_id": "046cac59e2aa3000",
"_check_name": "High CPU User Usage",
"_level": "crit",
"_measurement": "notifications",
"_message": "High CPU User Usage: rsavage.prod is crit",
"_notification_endpoint_id": "046cad0c83aec000",
"_notification_endpoint_name": "HTTP Endpoint",
"_notification_rule_id": "046dff53d4183000",
"_notification_rule_name": "HTTP Notification",
"_source_measurement": "cpu",
"_source_timestamp": 1567797375000000000,
"_start": "2019-09-06T19:15:59Z",
"_status_timestamp": 1567797376416632300,
"_stop": "2019-09-06T19:16:20.362006739Z",
"_time": "2019-09-06T19:16:20.609629338Z",
"_type": "threshold",
"_version": 1,
"cpu": "cpu-total",
"host": "rsavage.prod",
"usage_user": 91.12278069517379
}
```
2019-09-06 21:21:27 +00:00
|
|
|
return {headers: headers, data: json.encode(v: body)}
|
feat(notification/rule): add JSON body for the HTTP POST (#14994)
The body of the JSON webhook would be:
{
"version": 1,
"rule_name": notification._notification_rule_name,
"rule_id": notification._notification_rule_id,
"endpoint_name": notification._notification_endpoint_name,
"endpoint_id": notification._notification_endpoint_id,
"check_name": r._check_name,
"check_id": r._check_id,
"check_type": r._type,
"source_measurement": r._source_measurement,
"source_timestamp": r._source_timestamp,
"level": r._level,
"message": r._message,
}
2019-09-06 01:38:02 +00:00
|
|
|
}))`
|
2019-08-16 19:43:15 +00:00
|
|
|
|
|
|
|
s := &rule.HTTP{
|
|
|
|
Base: rule.Base{
|
2019-08-19 11:31:46 +00:00
|
|
|
ID: 1,
|
|
|
|
Name: "foo",
|
|
|
|
Every: mustDuration("1h"),
|
|
|
|
Offset: mustDuration("1s"),
|
|
|
|
EndpointID: 2,
|
2019-09-05 13:52:05 +00:00
|
|
|
TagRules: []notification.TagRule{},
|
2019-09-03 20:58:50 +00:00
|
|
|
StatusRules: []notification.StatusRule{
|
|
|
|
{
|
|
|
|
CurrentLevel: notification.Critical,
|
|
|
|
},
|
|
|
|
},
|
2019-08-16 19:43:15 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2019-08-27 17:29:49 +00:00
|
|
|
e := &endpoint.HTTP{
|
|
|
|
Base: endpoint.Base{
|
|
|
|
ID: 2,
|
|
|
|
Name: "foo",
|
|
|
|
},
|
|
|
|
URL: "http://localhost:7777",
|
|
|
|
}
|
|
|
|
|
|
|
|
f, err := s.GenerateFlux(e)
|
2019-08-16 19:43:15 +00:00
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
if f != want {
|
|
|
|
t.Errorf("scripts did not match. want:\n%v\n\ngot:\n%v", want, f)
|
|
|
|
}
|
|
|
|
}
|
2019-09-05 22:32:28 +00:00
|
|
|
|
|
|
|
func TestHTTP_GenerateFlux_basicAuth(t *testing.T) {
|
|
|
|
want := `package main
|
|
|
|
// foo
|
|
|
|
import "influxdata/influxdb/monitor"
|
|
|
|
import "http"
|
|
|
|
import "json"
|
|
|
|
import "experimental"
|
feat(notification/rule): add _version: 1 to HTTP body (#15028)
This adds the _version: 1 correctly to the body of the HTTP POST.
Additionally, this fixes the imports when using secrets.
The POSTed JSON body now is:
```json
{
"_check_id": "046cac59e2aa3000",
"_check_name": "High CPU User Usage",
"_level": "crit",
"_measurement": "notifications",
"_message": "High CPU User Usage: rsavage.prod is crit",
"_notification_endpoint_id": "046cad0c83aec000",
"_notification_endpoint_name": "HTTP Endpoint",
"_notification_rule_id": "046dff53d4183000",
"_notification_rule_name": "HTTP Notification",
"_source_measurement": "cpu",
"_source_timestamp": 1567797375000000000,
"_start": "2019-09-06T19:15:59Z",
"_status_timestamp": 1567797376416632300,
"_stop": "2019-09-06T19:16:20.362006739Z",
"_time": "2019-09-06T19:16:20.609629338Z",
"_type": "threshold",
"_version": 1,
"cpu": "cpu-total",
"host": "rsavage.prod",
"usage_user": 91.12278069517379
}
```
2019-09-06 21:21:27 +00:00
|
|
|
import "influxdata/influxdb/secrets"
|
2019-09-05 22:32:28 +00:00
|
|
|
|
|
|
|
option task = {name: "foo", every: 1h, offset: 1s}
|
|
|
|
|
|
|
|
headers = {"Content-Type": "application/json", "Authorization": http.basicAuth(u: secrets.get(key: "000000000000000e-username"), p: secrets.get(key: "000000000000000e-password"))}
|
|
|
|
endpoint = http.endpoint(url: "http://localhost:7777")
|
|
|
|
notification = {
|
|
|
|
_notification_rule_id: "0000000000000001",
|
|
|
|
_notification_rule_name: "foo",
|
|
|
|
_notification_endpoint_id: "0000000000000002",
|
|
|
|
_notification_endpoint_name: "foo",
|
|
|
|
}
|
|
|
|
statuses = monitor.from(start: -2h)
|
|
|
|
crit = statuses
|
|
|
|
|> filter(fn: (r) =>
|
|
|
|
(r._level == "crit"))
|
|
|
|
all_statuses = crit
|
|
|
|
|> filter(fn: (r) =>
|
|
|
|
(r._time > experimental.subDuration(from: now(), d: 1h)))
|
|
|
|
|
|
|
|
all_statuses
|
feat(notification/rule): add JSON body for the HTTP POST (#14994)
The body of the JSON webhook would be:
{
"version": 1,
"rule_name": notification._notification_rule_name,
"rule_id": notification._notification_rule_id,
"endpoint_name": notification._notification_endpoint_name,
"endpoint_id": notification._notification_endpoint_id,
"check_name": r._check_name,
"check_id": r._check_id,
"check_type": r._type,
"source_measurement": r._source_measurement,
"source_timestamp": r._source_timestamp,
"level": r._level,
"message": r._message,
}
2019-09-06 01:38:02 +00:00
|
|
|
|> monitor.notify(data: notification, endpoint: endpoint(mapFn: (r) => {
|
feat(notification/rule): add _version: 1 to HTTP body (#15028)
This adds the _version: 1 correctly to the body of the HTTP POST.
Additionally, this fixes the imports when using secrets.
The POSTed JSON body now is:
```json
{
"_check_id": "046cac59e2aa3000",
"_check_name": "High CPU User Usage",
"_level": "crit",
"_measurement": "notifications",
"_message": "High CPU User Usage: rsavage.prod is crit",
"_notification_endpoint_id": "046cad0c83aec000",
"_notification_endpoint_name": "HTTP Endpoint",
"_notification_rule_id": "046dff53d4183000",
"_notification_rule_name": "HTTP Notification",
"_source_measurement": "cpu",
"_source_timestamp": 1567797375000000000,
"_start": "2019-09-06T19:15:59Z",
"_status_timestamp": 1567797376416632300,
"_stop": "2019-09-06T19:16:20.362006739Z",
"_time": "2019-09-06T19:16:20.609629338Z",
"_type": "threshold",
"_version": 1,
"cpu": "cpu-total",
"host": "rsavage.prod",
"usage_user": 91.12278069517379
}
```
2019-09-06 21:21:27 +00:00
|
|
|
body = {r with _version: 1}
|
2019-09-05 22:32:28 +00:00
|
|
|
|
feat(notification/rule): add _version: 1 to HTTP body (#15028)
This adds the _version: 1 correctly to the body of the HTTP POST.
Additionally, this fixes the imports when using secrets.
The POSTed JSON body now is:
```json
{
"_check_id": "046cac59e2aa3000",
"_check_name": "High CPU User Usage",
"_level": "crit",
"_measurement": "notifications",
"_message": "High CPU User Usage: rsavage.prod is crit",
"_notification_endpoint_id": "046cad0c83aec000",
"_notification_endpoint_name": "HTTP Endpoint",
"_notification_rule_id": "046dff53d4183000",
"_notification_rule_name": "HTTP Notification",
"_source_measurement": "cpu",
"_source_timestamp": 1567797375000000000,
"_start": "2019-09-06T19:15:59Z",
"_status_timestamp": 1567797376416632300,
"_stop": "2019-09-06T19:16:20.362006739Z",
"_time": "2019-09-06T19:16:20.609629338Z",
"_type": "threshold",
"_version": 1,
"cpu": "cpu-total",
"host": "rsavage.prod",
"usage_user": 91.12278069517379
}
```
2019-09-06 21:21:27 +00:00
|
|
|
return {headers: headers, data: json.encode(v: body)}
|
feat(notification/rule): add JSON body for the HTTP POST (#14994)
The body of the JSON webhook would be:
{
"version": 1,
"rule_name": notification._notification_rule_name,
"rule_id": notification._notification_rule_id,
"endpoint_name": notification._notification_endpoint_name,
"endpoint_id": notification._notification_endpoint_id,
"check_name": r._check_name,
"check_id": r._check_id,
"check_type": r._type,
"source_measurement": r._source_measurement,
"source_timestamp": r._source_timestamp,
"level": r._level,
"message": r._message,
}
2019-09-06 01:38:02 +00:00
|
|
|
}))`
|
2019-09-05 22:32:28 +00:00
|
|
|
s := &rule.HTTP{
|
|
|
|
Base: rule.Base{
|
|
|
|
ID: 1,
|
|
|
|
Name: "foo",
|
|
|
|
Every: mustDuration("1h"),
|
|
|
|
Offset: mustDuration("1s"),
|
|
|
|
EndpointID: 2,
|
|
|
|
TagRules: []notification.TagRule{},
|
|
|
|
StatusRules: []notification.StatusRule{
|
|
|
|
{
|
|
|
|
CurrentLevel: notification.Critical,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
e := &endpoint.HTTP{
|
|
|
|
Base: endpoint.Base{
|
|
|
|
ID: 2,
|
|
|
|
Name: "foo",
|
|
|
|
},
|
|
|
|
URL: "http://localhost:7777",
|
|
|
|
AuthMethod: "basic",
|
|
|
|
Username: influxdb.SecretField{
|
|
|
|
Key: "000000000000000e-username",
|
|
|
|
},
|
|
|
|
Password: influxdb.SecretField{
|
|
|
|
Key: "000000000000000e-password",
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
f, err := s.GenerateFlux(e)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
if f != want {
|
|
|
|
t.Errorf("scripts did not match. want:\n%v\n\ngot:\n%v", want, f)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestHTTP_GenerateFlux_bearer(t *testing.T) {
|
|
|
|
want := `package main
|
|
|
|
// foo
|
|
|
|
import "influxdata/influxdb/monitor"
|
|
|
|
import "http"
|
|
|
|
import "json"
|
|
|
|
import "experimental"
|
feat(notification/rule): add _version: 1 to HTTP body (#15028)
This adds the _version: 1 correctly to the body of the HTTP POST.
Additionally, this fixes the imports when using secrets.
The POSTed JSON body now is:
```json
{
"_check_id": "046cac59e2aa3000",
"_check_name": "High CPU User Usage",
"_level": "crit",
"_measurement": "notifications",
"_message": "High CPU User Usage: rsavage.prod is crit",
"_notification_endpoint_id": "046cad0c83aec000",
"_notification_endpoint_name": "HTTP Endpoint",
"_notification_rule_id": "046dff53d4183000",
"_notification_rule_name": "HTTP Notification",
"_source_measurement": "cpu",
"_source_timestamp": 1567797375000000000,
"_start": "2019-09-06T19:15:59Z",
"_status_timestamp": 1567797376416632300,
"_stop": "2019-09-06T19:16:20.362006739Z",
"_time": "2019-09-06T19:16:20.609629338Z",
"_type": "threshold",
"_version": 1,
"cpu": "cpu-total",
"host": "rsavage.prod",
"usage_user": 91.12278069517379
}
```
2019-09-06 21:21:27 +00:00
|
|
|
import "influxdata/influxdb/secrets"
|
2019-09-05 22:32:28 +00:00
|
|
|
|
|
|
|
option task = {name: "foo", every: 1h, offset: 1s}
|
|
|
|
|
|
|
|
headers = {"Content-Type": "application/json", "Authorization": "Bearer " + secrets.get(key: "000000000000000e-token")}
|
|
|
|
endpoint = http.endpoint(url: "http://localhost:7777")
|
|
|
|
notification = {
|
|
|
|
_notification_rule_id: "0000000000000001",
|
|
|
|
_notification_rule_name: "foo",
|
|
|
|
_notification_endpoint_id: "0000000000000002",
|
|
|
|
_notification_endpoint_name: "foo",
|
|
|
|
}
|
|
|
|
statuses = monitor.from(start: -2h)
|
|
|
|
crit = statuses
|
|
|
|
|> filter(fn: (r) =>
|
|
|
|
(r._level == "crit"))
|
|
|
|
all_statuses = crit
|
|
|
|
|> filter(fn: (r) =>
|
|
|
|
(r._time > experimental.subDuration(from: now(), d: 1h)))
|
|
|
|
|
|
|
|
all_statuses
|
feat(notification/rule): add JSON body for the HTTP POST (#14994)
The body of the JSON webhook would be:
{
"version": 1,
"rule_name": notification._notification_rule_name,
"rule_id": notification._notification_rule_id,
"endpoint_name": notification._notification_endpoint_name,
"endpoint_id": notification._notification_endpoint_id,
"check_name": r._check_name,
"check_id": r._check_id,
"check_type": r._type,
"source_measurement": r._source_measurement,
"source_timestamp": r._source_timestamp,
"level": r._level,
"message": r._message,
}
2019-09-06 01:38:02 +00:00
|
|
|
|> monitor.notify(data: notification, endpoint: endpoint(mapFn: (r) => {
|
feat(notification/rule): add _version: 1 to HTTP body (#15028)
This adds the _version: 1 correctly to the body of the HTTP POST.
Additionally, this fixes the imports when using secrets.
The POSTed JSON body now is:
```json
{
"_check_id": "046cac59e2aa3000",
"_check_name": "High CPU User Usage",
"_level": "crit",
"_measurement": "notifications",
"_message": "High CPU User Usage: rsavage.prod is crit",
"_notification_endpoint_id": "046cad0c83aec000",
"_notification_endpoint_name": "HTTP Endpoint",
"_notification_rule_id": "046dff53d4183000",
"_notification_rule_name": "HTTP Notification",
"_source_measurement": "cpu",
"_source_timestamp": 1567797375000000000,
"_start": "2019-09-06T19:15:59Z",
"_status_timestamp": 1567797376416632300,
"_stop": "2019-09-06T19:16:20.362006739Z",
"_time": "2019-09-06T19:16:20.609629338Z",
"_type": "threshold",
"_version": 1,
"cpu": "cpu-total",
"host": "rsavage.prod",
"usage_user": 91.12278069517379
}
```
2019-09-06 21:21:27 +00:00
|
|
|
body = {r with _version: 1}
|
feat(notification/rule): add JSON body for the HTTP POST (#14994)
The body of the JSON webhook would be:
{
"version": 1,
"rule_name": notification._notification_rule_name,
"rule_id": notification._notification_rule_id,
"endpoint_name": notification._notification_endpoint_name,
"endpoint_id": notification._notification_endpoint_id,
"check_name": r._check_name,
"check_id": r._check_id,
"check_type": r._type,
"source_measurement": r._source_measurement,
"source_timestamp": r._source_timestamp,
"level": r._level,
"message": r._message,
}
2019-09-06 01:38:02 +00:00
|
|
|
|
feat(notification/rule): add _version: 1 to HTTP body (#15028)
This adds the _version: 1 correctly to the body of the HTTP POST.
Additionally, this fixes the imports when using secrets.
The POSTed JSON body now is:
```json
{
"_check_id": "046cac59e2aa3000",
"_check_name": "High CPU User Usage",
"_level": "crit",
"_measurement": "notifications",
"_message": "High CPU User Usage: rsavage.prod is crit",
"_notification_endpoint_id": "046cad0c83aec000",
"_notification_endpoint_name": "HTTP Endpoint",
"_notification_rule_id": "046dff53d4183000",
"_notification_rule_name": "HTTP Notification",
"_source_measurement": "cpu",
"_source_timestamp": 1567797375000000000,
"_start": "2019-09-06T19:15:59Z",
"_status_timestamp": 1567797376416632300,
"_stop": "2019-09-06T19:16:20.362006739Z",
"_time": "2019-09-06T19:16:20.609629338Z",
"_type": "threshold",
"_version": 1,
"cpu": "cpu-total",
"host": "rsavage.prod",
"usage_user": 91.12278069517379
}
```
2019-09-06 21:21:27 +00:00
|
|
|
return {headers: headers, data: json.encode(v: body)}
|
feat(notification/rule): add JSON body for the HTTP POST (#14994)
The body of the JSON webhook would be:
{
"version": 1,
"rule_name": notification._notification_rule_name,
"rule_id": notification._notification_rule_id,
"endpoint_name": notification._notification_endpoint_name,
"endpoint_id": notification._notification_endpoint_id,
"check_name": r._check_name,
"check_id": r._check_id,
"check_type": r._type,
"source_measurement": r._source_measurement,
"source_timestamp": r._source_timestamp,
"level": r._level,
"message": r._message,
}
2019-09-06 01:38:02 +00:00
|
|
|
}))`
|
2019-09-05 22:32:28 +00:00
|
|
|
|
|
|
|
s := &rule.HTTP{
|
|
|
|
Base: rule.Base{
|
|
|
|
ID: 1,
|
|
|
|
Name: "foo",
|
|
|
|
Every: mustDuration("1h"),
|
|
|
|
Offset: mustDuration("1s"),
|
|
|
|
EndpointID: 2,
|
|
|
|
TagRules: []notification.TagRule{},
|
|
|
|
StatusRules: []notification.StatusRule{
|
|
|
|
{
|
|
|
|
CurrentLevel: notification.Critical,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
e := &endpoint.HTTP{
|
|
|
|
Base: endpoint.Base{
|
|
|
|
ID: 2,
|
|
|
|
Name: "foo",
|
|
|
|
},
|
|
|
|
URL: "http://localhost:7777",
|
|
|
|
AuthMethod: "bearer",
|
|
|
|
Token: influxdb.SecretField{
|
|
|
|
Key: "000000000000000e-token",
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
f, err := s.GenerateFlux(e)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
if f != want {
|
|
|
|
t.Errorf("scripts did not match. want:\n%v\n\ngot:\n%v", want, f)
|
|
|
|
}
|
|
|
|
}
|