Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
flame-clmc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
flame
flame-clmc
Commits
881934bc
Commit
881934bc
authored
7 years ago
by
Nikolay Stanchev
Browse files
Options
Downloads
Patches
Plain Diff
Slight refactoring of telegraph agent test
parent
417be55b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/telegraf-agents/test_telegraf_agents.py
+11
-4
11 additions, 4 deletions
test/telegraf-agents/test_telegraf_agents.py
with
11 additions
and
4 deletions
test/telegraf-agents/test_telegraf_agents.py
+
11
−
4
View file @
881934bc
...
...
@@ -9,16 +9,23 @@ import pytest
(
'
mongodb
'
,
'
SELECT mean(
"
net_in_bytes
"
) AS
"
mean
"
FROM
"
CLMCMetrics
"
.
"
autogen
"
.
"
mongodb
"'
,
0
)
])
def
test_all_inputs
(
influxdb
,
measurement
,
query
,
expected_result
):
"""
Tests measurements are received from an input plugin aggregated across all services
"""
Tests measurements are received from an input plugin aggregated across all services
:param influxdb: the influx db client fixture
:param measurement: the measurement to test
:param query: the query to execute
:param expected_result: the expected result from the query
"""
query_result
=
influxdb
.
query
(
'
SHOW measurements ON
"
CLMCMetrics
"'
)
points
=
list
(
query_result
.
get_points
())
assert
any
(
p
[
'
name
'
]
==
measurement
for
p
in
points
),
"
{0} not in measurement list
"
.
format
(
measurement
)
query_result
=
influxdb
.
query
(
query
)
points
=
lis
t
(
query_result
.
get_points
())
actual_result
=
points
[
0
][
'
mean
'
]
assert
actual_result
>
expected_result
,
"
actual result {0} is not > expected result {1} for query {2}
"
.
format
(
actual_result
,
str
(
expected_result
),
query
)
points
=
nex
t
(
query_result
.
get_points
())
# get_points() returns a generator, to take the first element we can use the next() function
actual_result
=
points
[
'
mean
'
]
assert
actual_result
>
expected_result
,
"
actual result {0} is not > expected result {1} for query {2}
"
.
format
(
actual_result
,
str
(
expected_result
),
query
)
@pytest.mark.parametrize
(
"
ipendpoint, measurements
"
,
[
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment