-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Host status test #216
Merged
Merged
Host status test #216
Changes from 7 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
89dc63b
update panel selector
fbalak c27a41a
add workload_stop_nodes fixture
fbalak 3ea39e7
add test_hosts testcase
fbalak 1a4a136
change playbook names
fbalak 0b74563
remove unnecessary print statement
fbalak 6a55d91
change status test timing
fbalak b05a841
update graphite data condition comparison
fbalak 86b712f
Merge branch 'master' into status-test
fbalak e1c5abe
add logger messages for sleep functions
fbalak 29a2ed7
update graphite date check
fbalak 1ea6cf4
increase divergence for number of machines
fbalak 122c60a
Merge branch 'status-test' of https://github.com/fbalak/usmqe-tests i…
fbalak 52f2df9
fix panel selection
fbalak 0c6028e
improve graphite logging
fbalak 690e3fb
xfail bz 1687333
fbalak 0ac64fb
add testready marker to test_hosts
fbalak File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
""" | ||
|
||
import pytest | ||
import time | ||
from usmqe.api.grafanaapi import grafanaapi | ||
from usmqe.api.graphiteapi import graphiteapi | ||
from usmqe.gluster.gluster import GlusterCommon | ||
|
@@ -209,3 +210,68 @@ def test_hosts_panel_status(cluster_reuse): | |
g_down == len(real_down), | ||
"Number of hosts that are down in graphite ({}) should be {}".format( | ||
g_down, len(real_down))) | ||
|
||
|
||
@pytest.mark.ansible_playbook_setup("test_setup.tendrl_services_stopped_on_nodes.yml") | ||
@pytest.mark.ansible_playbook_teardown("test_teardown.tendrl_services_stopped_on_nodes.yml") | ||
@pytest.mark.author("[email protected]") | ||
def test_hosts(ansible_playbook, workload_stop_nodes, cluster_reuse): | ||
""" | ||
Check that Grafana panel *Hosts* is showing correct values. | ||
""" | ||
if cluster_reuse["short_name"]: | ||
cluster_identifier = cluster_reuse["short_name"] | ||
else: | ||
cluster_identifier = cluster_reuse["integration_id"] | ||
|
||
grafana = grafanaapi.GrafanaApi() | ||
graphite = graphiteapi.GraphiteApi() | ||
|
||
hosts_panel = grafana.get_panel( | ||
"Hosts", | ||
row_title="At-a-glance", | ||
dashboard="cluster-dashboard") | ||
|
||
""" | ||
:step: | ||
Send **GET** request to ``GRAPHITE/render?target=[target]&format=json`` | ||
where [target] is part of uri obtained from previous GRAFANA call. | ||
There should be target for statuses of a hosts. | ||
Compare number of hosts from Graphite with value retrieved from | ||
``workload_stop_nodes`` fixture. | ||
:result: | ||
JSON structure containing data related to hosts status is similar | ||
to values set by ``workload_stop_nodes`` fixture in given time. | ||
""" | ||
# get graphite target pointing at data containing numbers of hosts | ||
targets = grafana.get_panel_chart_targets(hosts_panel, cluster_identifier) | ||
targets_used = (targets[0][0], targets[1][0], targets[2][0]) | ||
targets_expected = ('nodes_count.total', 'nodes_count.up', 'nodes_count.down') | ||
for idx, target in enumerate(targets_used): | ||
pytest.check( | ||
target.endswith(targets_expected[idx]), | ||
"There is used target that ends with `{}`".format( | ||
targets_expected[idx])) | ||
# make sure that all data in graphite are saved | ||
time.sleep(3) | ||
# check value *Total* of hosts | ||
graphite.compare_data_mean( | ||
workload_stop_nodes["result"], | ||
(targets_used[0],), | ||
workload_stop_nodes["start"], | ||
workload_stop_nodes["end"], | ||
divergence=0) | ||
# check value *Up* of hosts | ||
graphite.compare_data_mean( | ||
0.0, | ||
(targets_used[1],), | ||
workload_stop_nodes["start"], | ||
workload_stop_nodes["end"], | ||
divergence=0) | ||
# check value *Down* of hosts | ||
graphite.compare_data_mean( | ||
workload_stop_nodes["result"], | ||
(targets_used[2],), | ||
workload_stop_nodes["start"], | ||
workload_stop_nodes["end"], | ||
divergence=0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add a log line, which states what you stated in the comment: wait for tendrl to notice that nodes are down. It would make it more clear what's going on when one checks logs while the test is running.