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
78d72007
Unverified
Commit
78d72007
authored
Jan 06, 2021
by
Emil Hessman
Committed by
GitHub
Jan 06, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Chore: Rewrite tsdb cloudmonitoring test to standard library (#30090)
parent
6f72ae38
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
21 deletions
+16
-21
pkg/tsdb/cloudmonitoring/annotation_query_test.go
+16
-21
No files found.
pkg/tsdb/cloudmonitoring/annotation_query_test.go
View file @
78d72007
...
@@ -5,29 +5,24 @@ import (
...
@@ -5,29 +5,24 @@ import (
"github.com/grafana/grafana/pkg/components/simplejson"
"github.com/grafana/grafana/pkg/components/simplejson"
"github.com/grafana/grafana/pkg/tsdb"
"github.com/grafana/grafana/pkg/tsdb"
"github.com/stretchr/testify/assert"
.
"github.com/smartystreets/goconvey/convey
"
"github.com/stretchr/testify/require
"
)
)
func
TestCloudMonitoring
AnnotationQuery
(
t
*
testing
.
T
)
{
func
TestCloudMonitoring
Executor_parseToAnnotations
(
t
*
testing
.
T
)
{
Convey
(
"CloudMonitoring Annotation Query Executor"
,
t
,
func
()
{
data
,
err
:=
loadTestFile
(
"./test-data/2-series-response-no-agg.json"
)
executor
:=
&
CloudMonitoringExecutor
{}
require
.
NoError
(
t
,
err
)
Convey
(
"When parsing the cloud monitoring api response"
,
func
()
{
require
.
Len
(
t
,
data
.
TimeSeries
,
3
)
data
,
err
:=
loadTestFile
(
"./test-data/2-series-response-no-agg.json"
)
So
(
err
,
ShouldBeNil
)
res
:=
&
tsdb
.
QueryResult
{
Meta
:
simplejson
.
New
(),
RefId
:
"annotationQuery"
}
So
(
len
(
data
.
TimeSeries
),
ShouldEqual
,
3
)
query
:=
&
cloudMonitoringQuery
{}
res
:=
&
tsdb
.
QueryResult
{
Meta
:
simplejson
.
New
(),
RefId
:
"annotationQuery"
}
executor
:=
&
CloudMonitoringExecutor
{}
query
:=
&
cloudMonitoringQuery
{}
err
=
executor
.
parseToAnnotations
(
res
,
data
,
query
,
"atitle {{metric.label.instance_name}} {{metric.value}}"
,
"atext {{resource.label.zone}}"
,
"atag"
)
err
=
executor
.
parseToAnnotations
(
res
,
data
,
query
,
"atitle {{metric.label.instance_name}} {{metric.value}}"
,
"atext {{resource.label.zone}}"
,
"atag"
)
require
.
NoError
(
t
,
err
)
So
(
err
,
ShouldBeNil
)
Convey
(
"Should return annotations table"
,
func
()
{
require
.
Len
(
t
,
res
.
Tables
,
1
)
So
(
len
(
res
.
Tables
),
ShouldEqual
,
1
)
require
.
Len
(
t
,
res
.
Tables
[
0
]
.
Rows
,
9
)
So
(
len
(
res
.
Tables
[
0
]
.
Rows
),
ShouldEqual
,
9
)
assert
.
Equal
(
t
,
"atitle collector-asia-east-1 9.856650"
,
res
.
Tables
[
0
]
.
Rows
[
0
][
1
])
So
(
res
.
Tables
[
0
]
.
Rows
[
0
][
1
],
ShouldEqual
,
"atitle collector-asia-east-1 9.856650"
)
assert
.
Equal
(
t
,
"atext asia-east1-a"
,
res
.
Tables
[
0
]
.
Rows
[
0
][
3
])
So
(
res
.
Tables
[
0
]
.
Rows
[
0
][
3
],
ShouldEqual
,
"atext asia-east1-a"
)
})
})
})
}
}
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