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
38a52c24
Unverified
Commit
38a52c24
authored
Jul 30, 2018
by
Marcus Efraimsson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mssql: update tests
parent
e32cf75c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
39 deletions
+15
-39
pkg/tsdb/mssql/mssql_test.go
+15
-39
No files found.
pkg/tsdb/mssql/mssql_test.go
View file @
38a52c24
...
...
@@ -615,7 +615,7 @@ func TestMSSQL(t *testing.T) {
Queries
:
[]
*
tsdb
.
Query
{
{
Model
:
simplejson
.
NewFromAny
(
map
[
string
]
interface
{}{
"rawSql"
:
"SELECT $__timeEpoch(time), measurement
AS metric
, valueOne, valueTwo FROM metric_values ORDER BY 1"
,
"rawSql"
:
"SELECT $__timeEpoch(time), measurement, valueOne, valueTwo FROM metric_values ORDER BY 1"
,
"format"
:
"time_series"
,
}),
RefId
:
"A"
,
...
...
@@ -660,21 +660,9 @@ func TestMSSQL(t *testing.T) {
SELECT
CAST(ROUND(DATEDIFF(second, '1970-01-01', time)/CAST(@dInterval as float), 0) as bigint)*@dInterval as time,
measurement + ' - value one' as metric,
avg(valueOne) as value
FROM
metric_values
WHERE
time BETWEEN DATEADD(s, @from, '1970-01-01') AND DATEADD(s, @to, '1970-01-01') AND
(@metric = 'ALL' OR measurement = @metric)
GROUP BY
CAST(ROUND(DATEDIFF(second, '1970-01-01', time)/CAST(@dInterval as float), 0) as bigint)*@dInterval,
measurement
UNION ALL
SELECT
CAST(ROUND(DATEDIFF(second, '1970-01-01', time)/CAST(@dInterval as float), 0) as bigint)*@dInterval as time,
measurement + ' - value two' as metric,
avg(valueTwo) as value
measurement as metric,
avg(valueOne) as valueOne,
avg(valueTwo) as valueTwo
FROM
metric_values
WHERE
...
...
@@ -717,10 +705,10 @@ func TestMSSQL(t *testing.T) {
So
(
queryResult
.
Error
,
ShouldBeNil
)
So
(
len
(
queryResult
.
Series
),
ShouldEqual
,
4
)
So
(
queryResult
.
Series
[
0
]
.
Name
,
ShouldEqual
,
"Metric A
- value o
ne"
)
So
(
queryResult
.
Series
[
1
]
.
Name
,
ShouldEqual
,
"Metric
B - value one
"
)
So
(
queryResult
.
Series
[
2
]
.
Name
,
ShouldEqual
,
"Metric
A - value two
"
)
So
(
queryResult
.
Series
[
3
]
.
Name
,
ShouldEqual
,
"Metric B
- value t
wo"
)
So
(
queryResult
.
Series
[
0
]
.
Name
,
ShouldEqual
,
"Metric A
valueO
ne"
)
So
(
queryResult
.
Series
[
1
]
.
Name
,
ShouldEqual
,
"Metric
A valueTwo
"
)
So
(
queryResult
.
Series
[
2
]
.
Name
,
ShouldEqual
,
"Metric
B valueOne
"
)
So
(
queryResult
.
Series
[
3
]
.
Name
,
ShouldEqual
,
"Metric B
valueT
wo"
)
})
})
...
...
@@ -749,21 +737,9 @@ func TestMSSQL(t *testing.T) {
SELECT
CAST(ROUND(DATEDIFF(second, '1970-01-01', time)/CAST(@dInterval as float), 0) as bigint)*@dInterval as time,
measurement + ' - value one' as metric,
avg(valueOne) as value
FROM
metric_values
WHERE
time BETWEEN @from AND @to AND
(@metric = 'ALL' OR measurement = @metric)
GROUP BY
CAST(ROUND(DATEDIFF(second, '1970-01-01', time)/CAST(@dInterval as float), 0) as bigint)*@dInterval,
measurement
UNION ALL
SELECT
CAST(ROUND(DATEDIFF(second, '1970-01-01', time)/CAST(@dInterval as float), 0) as bigint)*@dInterval as time,
measurement + ' - value two' as metric,
avg(valueTwo) as value
measurement as metric,
avg(valueOne) as valueOne,
avg(valueTwo) as valueTwo
FROM
metric_values
WHERE
...
...
@@ -806,10 +782,10 @@ func TestMSSQL(t *testing.T) {
So
(
queryResult
.
Error
,
ShouldBeNil
)
So
(
len
(
queryResult
.
Series
),
ShouldEqual
,
4
)
So
(
queryResult
.
Series
[
0
]
.
Name
,
ShouldEqual
,
"Metric A
- value o
ne"
)
So
(
queryResult
.
Series
[
1
]
.
Name
,
ShouldEqual
,
"Metric
B - value one
"
)
So
(
queryResult
.
Series
[
2
]
.
Name
,
ShouldEqual
,
"Metric
A - value two
"
)
So
(
queryResult
.
Series
[
3
]
.
Name
,
ShouldEqual
,
"Metric B
- value t
wo"
)
So
(
queryResult
.
Series
[
0
]
.
Name
,
ShouldEqual
,
"Metric A
valueO
ne"
)
So
(
queryResult
.
Series
[
1
]
.
Name
,
ShouldEqual
,
"Metric
A valueTwo
"
)
So
(
queryResult
.
Series
[
2
]
.
Name
,
ShouldEqual
,
"Metric
B valueOne
"
)
So
(
queryResult
.
Series
[
3
]
.
Name
,
ShouldEqual
,
"Metric B
valueT
wo"
)
})
})
})
...
...
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