Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
f5cc7618
Commit
f5cc7618
authored
Jul 17, 2018
by
Daniel Lee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
alert: add missing test after refactor
parent
92d417f6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
2 deletions
+13
-2
pkg/services/sqlstore/alert_test.go
+13
-2
No files found.
pkg/services/sqlstore/alert_test.go
View file @
f5cc7618
...
...
@@ -13,7 +13,7 @@ func mockTimeNow() {
var
timeSeed
int64
timeNow
=
func
()
time
.
Time
{
fakeNow
:=
time
.
Unix
(
timeSeed
,
0
)
timeSeed
+=
1
timeSeed
++
return
fakeNow
}
}
...
...
@@ -30,7 +30,7 @@ func TestAlertingDataAccess(t *testing.T) {
InitTestDB
(
t
)
testDash
:=
insertTestDashboard
(
"dashboard with alerts"
,
1
,
0
,
false
,
"alert"
)
evalData
,
_
:=
simplejson
.
NewJson
([]
byte
(
`{"test": "test"}`
))
items
:=
[]
*
m
.
Alert
{
{
PanelId
:
1
,
...
...
@@ -40,6 +40,7 @@ func TestAlertingDataAccess(t *testing.T) {
Message
:
"Alerting message"
,
Settings
:
simplejson
.
New
(),
Frequency
:
1
,
EvalData
:
evalData
,
},
}
...
...
@@ -104,8 +105,18 @@ func TestAlertingDataAccess(t *testing.T) {
alert
:=
alertQuery
.
Result
[
0
]
So
(
err2
,
ShouldBeNil
)
So
(
alert
.
Id
,
ShouldBeGreaterThan
,
0
)
So
(
alert
.
DashboardId
,
ShouldEqual
,
testDash
.
Id
)
So
(
alert
.
PanelId
,
ShouldEqual
,
1
)
So
(
alert
.
Name
,
ShouldEqual
,
"Alerting title"
)
So
(
alert
.
State
,
ShouldEqual
,
"pending"
)
So
(
alert
.
NewStateDate
,
ShouldNotBeNil
)
So
(
alert
.
EvalData
,
ShouldNotBeNil
)
So
(
alert
.
EvalData
.
Get
(
"test"
)
.
MustString
(),
ShouldEqual
,
"test"
)
So
(
alert
.
EvalDate
,
ShouldNotBeNil
)
So
(
alert
.
ExecutionError
,
ShouldEqual
,
""
)
So
(
alert
.
DashboardUid
,
ShouldNotBeNil
)
So
(
alert
.
DashboardSlug
,
ShouldEqual
,
"dashboard-with-alerts"
)
})
Convey
(
"Viewer cannot read alerts"
,
func
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment