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
1f344202
Commit
1f344202
authored
Feb 16, 2018
by
Leonard Gram
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
alerts: refactoring tests
parent
c5226a94
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
14 deletions
+12
-14
pkg/services/sqlstore/alert_test.go
+12
-14
No files found.
pkg/services/sqlstore/alert_test.go
View file @
1f344202
...
...
@@ -67,8 +67,7 @@ func TestAlertingDataAccess(t *testing.T) {
So
(
err
,
ShouldBeNil
)
})
alert
,
err
:=
getAlertById
(
1
)
So
(
err
,
ShouldBeNil
)
alert
,
_
:=
getAlertById
(
1
)
stateDateBeforePause
:=
alert
.
NewStateDate
Convey
(
"can pause all alerts"
,
func
()
{
...
...
@@ -237,14 +236,6 @@ func TestAlertingDataAccess(t *testing.T) {
})
})
}
func
pauseAllAlerts
(
pauseState
bool
)
error
{
cmd
:=
&
m
.
PauseAllAlertCommand
{
Paused
:
pauseState
,
}
err
:=
PauseAllAlerts
(
cmd
)
So
(
err
,
ShouldBeNil
)
return
err
}
func
TestPausingAlerts
(
t
*
testing
.
T
)
{
mockTimeNow
()
...
...
@@ -262,8 +253,7 @@ func TestPausingAlerts(t *testing.T) {
pauseAlert
(
testDash
.
OrgId
,
1
,
true
)
Convey
(
"the NewStateDate should be updated"
,
func
()
{
alert
,
err
:=
getAlertById
(
1
)
So
(
err
,
ShouldBeNil
)
alert
,
_
:=
getAlertById
(
1
)
stateDateAfterPause
=
alert
.
NewStateDate
So
(
stateDateBeforePause
,
ShouldHappenBefore
,
stateDateAfterPause
)
...
...
@@ -274,8 +264,7 @@ func TestPausingAlerts(t *testing.T) {
pauseAlert
(
testDash
.
OrgId
,
1
,
false
)
Convey
(
"the NewStateDate should be updated again"
,
func
()
{
alert
,
err
:=
getAlertById
(
1
)
So
(
err
,
ShouldBeNil
)
alert
,
_
:=
getAlertById
(
1
)
stateDateAfterUnpause
:=
alert
.
NewStateDate
So
(
stateDateAfterPause
,
ShouldHappenBefore
,
stateDateAfterUnpause
)
...
...
@@ -325,3 +314,12 @@ func getAlertById(id int64) (*m.Alert, error) {
So
(
err
,
ShouldBeNil
)
return
q
.
Result
,
err
}
func
pauseAllAlerts
(
pauseState
bool
)
error
{
cmd
:=
&
m
.
PauseAllAlertCommand
{
Paused
:
pauseState
,
}
err
:=
PauseAllAlerts
(
cmd
)
So
(
err
,
ShouldBeNil
)
return
err
}
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