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
be6cb24e
Commit
be6cb24e
authored
Sep 29, 2015
by
Mitsuhiro Tanda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix cloudwatch test
parent
1a63d9eb
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
15 deletions
+30
-15
public/test/specs/cloudwatch-datasource-specs.js
+30
-15
No files found.
public/test/specs/cloudwatch-datasource-specs.js
View file @
be6cb24e
...
...
@@ -53,19 +53,17 @@ define([
};
beforeEach
(
function
()
{
ctx
.
ds
.
get
CloudWatch
Client
=
function
()
{
ctx
.
ds
.
get
Aws
Client
=
function
()
{
return
{
getMetricStatistics
:
function
(
params
,
callback
)
{
setTimeout
(
function
()
{
requestParams
=
params
;
callback
(
null
,
response
);
},
0
);
}
};
};
});
it
(
'should generate the correct query'
,
function
()
{
it
(
'should generate the correct query'
,
function
(
done
)
{
ctx
.
ds
.
query
(
query
).
then
(
function
()
{
expect
(
requestParams
.
Namespace
).
to
.
be
(
query
.
targets
[
0
].
namespace
);
expect
(
requestParams
.
MetricName
).
to
.
be
(
query
.
targets
[
0
].
metricName
);
...
...
@@ -73,15 +71,19 @@ define([
expect
(
requestParams
.
Dimensions
[
0
].
Value
).
to
.
be
(
query
.
targets
[
0
].
dimensions
[
Object
.
keys
(
query
.
targets
[
0
].
dimensions
)[
0
]]);
expect
(
requestParams
.
Statistics
).
to
.
eql
(
Object
.
keys
(
query
.
targets
[
0
].
statistics
));
expect
(
requestParams
.
Period
).
to
.
be
(
query
.
targets
[
0
].
period
);
done
();
});
ctx
.
$rootScope
.
$apply
();
});
it
(
'should return series list'
,
function
()
{
it
(
'should return series list'
,
function
(
done
)
{
ctx
.
ds
.
query
(
query
).
then
(
function
(
result
)
{
var
s
=
Object
.
keys
(
query
.
targets
[
0
].
statistics
)[
0
];
expect
(
result
.
data
[
0
].
target
).
to
.
be
(
response
.
Label
+
s
);
expect
(
result
.
data
[
0
].
target
).
to
.
be
(
response
.
Label
+
'_'
+
s
+
JSON
.
stringify
(
query
.
targets
[
0
].
dimensions
)
);
expect
(
result
.
data
[
0
].
datapoints
[
0
][
0
]).
to
.
be
(
response
.
Datapoints
[
0
][
s
]);
done
();
});
ctx
.
$rootScope
.
$apply
();
});
});
...
...
@@ -104,51 +106,64 @@ define([
};
beforeEach
(
function
()
{
ctx
.
ds
.
get
CloudWatch
Client
=
function
()
{
ctx
.
ds
.
get
Aws
Client
=
function
()
{
return
{
listMetrics
:
function
(
params
,
callback
)
{
setTimeout
(
function
()
{
requestParams
=
params
;
callback
(
null
,
response
);
},
0
);
}
};
};
});
it
(
'should return suggest list for region()'
,
function
()
{
it
(
'should return suggest list for region()'
,
function
(
done
)
{
var
query
=
'region()'
;
ctx
.
ds
.
metricFindQuery
(
query
).
then
(
function
(
result
)
{
result
=
result
.
map
(
function
(
v
)
{
return
v
.
text
;
});
expect
(
result
).
to
.
contain
(
'us-east-1'
);
done
();
});
ctx
.
$rootScope
.
$apply
();
});
it
(
'should return suggest list for namespace()'
,
function
()
{
it
(
'should return suggest list for namespace()'
,
function
(
done
)
{
var
query
=
'namespace()'
;
ctx
.
ds
.
metricFindQuery
(
query
).
then
(
function
(
result
)
{
result
=
result
.
map
(
function
(
v
)
{
return
v
.
text
;
});
expect
(
result
).
to
.
contain
(
'AWS/EC2'
);
done
();
});
ctx
.
$rootScope
.
$apply
();
});
it
(
'should return suggest list for metrics()'
,
function
()
{
it
(
'should return suggest list for metrics()'
,
function
(
done
)
{
var
query
=
'metrics(AWS/EC2)'
;
ctx
.
ds
.
metricFindQuery
(
query
).
then
(
function
(
result
)
{
result
=
result
.
map
(
function
(
v
)
{
return
v
.
text
;
});
expect
(
result
).
to
.
contain
(
'CPUUtilization'
);
done
();
});
ctx
.
$rootScope
.
$apply
();
});
it
(
'should return suggest list for dimension_keys()'
,
function
()
{
it
(
'should return suggest list for dimension_keys()'
,
function
(
done
)
{
var
query
=
'dimension_keys(AWS/EC2)'
;
ctx
.
ds
.
metricFindQuery
(
query
).
then
(
function
(
result
)
{
result
=
result
.
map
(
function
(
v
)
{
return
v
.
text
;
});
expect
(
result
).
to
.
contain
(
'InstanceId'
);
done
();
});
ctx
.
$rootScope
.
$apply
();
});
it
(
'should return suggest list for dimension_values()'
,
function
()
{
it
(
'should return suggest list for dimension_values()'
,
function
(
done
)
{
var
query
=
'dimension_values(us-east-1,AWS/EC2,CPUUtilization)'
;
ctx
.
ds
.
metricFindQuery
(
query
).
then
(
function
(
result
)
{
expect
(
result
).
to
.
contain
(
'InstanceId'
);
result
=
result
.
map
(
function
(
v
)
{
return
v
.
text
;
});
expect
(
result
).
to
.
eql
([
'InstanceId=i-12345678'
]);
done
();
});
ctx
.
$rootScope
.
$apply
();
});
});
});
...
...
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