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
fa1d2257
Commit
fa1d2257
authored
Oct 10, 2018
by
Erik Sundell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stackdriver: fix failing test
parent
8b4fff8b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
41 deletions
+6
-41
public/app/plugins/datasource/stackdriver/datasource.ts
+3
-3
public/app/plugins/datasource/stackdriver/specs/datasource.test.ts
+3
-38
No files found.
public/app/plugins/datasource/stackdriver/datasource.ts
View file @
fa1d2257
...
...
@@ -198,13 +198,13 @@ export default class StackdriverDatasource {
title
:
'Success'
,
};
}
catch
(
error
)
{
console
.
log
(
error
.
data
.
error
);
let
message
=
'Stackdriver: '
;
message
+=
error
.
statusText
?
error
.
statusText
+
': '
:
''
;
if
(
error
.
data
&&
error
.
data
.
error
&&
error
.
data
.
error
)
{
if
(
error
.
data
&&
error
.
data
.
error
)
{
try
{
console
.
log
(
error
.
data
.
error
);
const
res
=
JSON
.
parse
(
error
.
data
.
error
);
console
.
log
(
res
);
message
+=
res
.
error
.
code
+
'. '
+
res
.
error
.
message
;
}
catch
(
err
)
{
message
+=
error
.
data
.
error
;
...
...
public/app/plugins/datasource/stackdriver/specs/datasource.test.ts
View file @
fa1d2257
...
...
@@ -53,7 +53,9 @@ describe('StackdriverDataSource', () => {
datasourceRequest
:
async
()
=>
Promise
.
reject
({
statusText
:
'Bad Request'
,
data
:
{
error
:
{
code
:
400
,
message
:
'Field interval.endTime had an invalid value'
}
},
data
:
{
error
:
JSON
.
stringify
({
error
:
{
code
:
400
,
message
:
'Field interval.endTime had an invalid value'
}
}),
},
}),
};
ds
=
new
StackdriverDataSource
(
instanceSettings
,
backendSrv
,
templateSrv
,
timeSrv
);
...
...
@@ -67,43 +69,6 @@ describe('StackdriverDataSource', () => {
});
});
describe
(
'when performing getProjects'
,
()
=>
{
describe
(
'and call to resource manager api succeeds'
,
()
=>
{
let
ds
;
let
result
;
beforeEach
(
async
()
=>
{
const
response
=
{
projects
:
[
{
projectNumber
:
'853996325002'
,
projectId
:
'test-project'
,
lifecycleState
:
'ACTIVE'
,
name
:
'Test Project'
,
createTime
:
'2015-06-02T14:16:08.520Z'
,
parent
:
{
type
:
'organization'
,
id
:
'853996325002'
,
},
},
],
};
const
backendSrv
=
{
async
datasourceRequest
()
{
return
Promise
.
resolve
({
status
:
200
,
data
:
response
});
},
};
ds
=
new
StackdriverDataSource
(
instanceSettings
,
backendSrv
,
templateSrv
,
timeSrv
);
result
=
await
ds
.
getProjects
();
});
it
(
'should return successfully'
,
()
=>
{
expect
(
result
.
length
).
toBe
(
1
);
expect
(
result
[
0
].
id
).
toBe
(
'test-project'
);
expect
(
result
[
0
].
name
).
toBe
(
'Test Project'
);
});
});
});
describe
(
'When performing query'
,
()
=>
{
const
options
=
{
range
:
{
...
...
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