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
2b5ac6ba
Commit
2b5ac6ba
authored
Mar 15, 2019
by
ryan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add test file
parent
e787176b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
0 deletions
+37
-0
pkg/tsdb/testdata/scenarios_test.go
+37
-0
No files found.
pkg/tsdb/testdata/scenarios_test.go
0 → 100644
View file @
2b5ac6ba
package
testdata
import
(
"testing"
"time"
"github.com/grafana/grafana/pkg/components/simplejson"
"github.com/grafana/grafana/pkg/tsdb"
.
"github.com/smartystreets/goconvey/convey"
)
func
TestTestdataScenarios
(
t
*
testing
.
T
)
{
Convey
(
"random walk "
,
t
,
func
()
{
if
scenario
,
exist
:=
ScenarioRegistry
[
"random_walk"
];
exist
{
Convey
(
"Should start at the requested value"
,
func
()
{
req
:=
&
tsdb
.
TsdbQuery
{
TimeRange
:
tsdb
.
NewFakeTimeRange
(
"5m"
,
"now"
,
time
.
Now
()),
Queries
:
[]
*
tsdb
.
Query
{
{
RefId
:
"A"
,
IntervalMs
:
100
,
MaxDataPoints
:
10
,
Model
:
simplejson
.
New
()},
},
}
query
:=
req
.
Queries
[
0
]
query
.
Model
.
Set
(
"startValue"
,
1.234
)
result
:=
scenario
.
Handler
(
req
.
Queries
[
0
],
req
)
points
:=
result
.
Series
[
0
]
.
Points
So
(
result
.
Series
,
ShouldNotBeNil
)
So
(
points
[
0
][
0
]
.
Float64
,
ShouldEqual
,
1.234
)
})
}
else
{
t
.
Fail
()
}
})
}
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