if hasattr(self.ctx, 'summary'):
self.ctx.summary['pcp_grafana_url'] = grafana_url
if self.use_graphite:
- self.graphite.download_graphs()
- self.graphite.write_html(mode='static')
+ try:
+ self.graphite.download_graphs()
+ self.graphite.write_html(mode='static')
+ except requests.ConnectionError:
+ log.exception("Downloading graphs failed!")
+ self.graphite.write_html()
if self.fetch_archives:
for remote in self.cluster.remotes.keys():
log.info("Copying PCP data into archive...")
import os
+import requests
import urlparse
-from mock import patch, DEFAULT, Mock, MagicMock
+from mock import patch, DEFAULT, Mock, MagicMock, call
from pytest import raises
from teuthology.config import config, FakeNamespace
second_call = task.graphite.write_html.call_args_list[1]
assert second_call[1]['mode'] == 'static'
assert isinstance(task.stop_time, int)
+
+ @patch('os.makedirs')
+ @patch('teuthology.task.pcp.GrafanaGrapher')
+ @patch('teuthology.task.pcp.GraphiteGrapher')
+ def test_end_16049(self, m_grafana, m_graphite, m_makedirs):
+ # http://tracker.ceph.com/issues/16049
+ # Jobs were failing if graph downloading failed. We don't want that.
+ self.ctx.archive = '/fake/path'
+ with self.klass(self.ctx, self.task_config) as task:
+ task.graphite.download_graphs.side_effect = \
+ requests.ConnectionError
+ # Even though downloading graphs failed, we should have called
+ # write_html() a second time, again with no args
+ assert task.graphite.write_html.call_args_list == [call(), call()]
+ assert isinstance(task.stop_time, int)