]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
pcp: Don't fail a job if graph downloading fails 867/head
authorZack Cerza <zack@redhat.com>
Tue, 31 May 2016 15:54:34 +0000 (09:54 -0600)
committerZack Cerza <zack@redhat.com>
Tue, 31 May 2016 17:31:11 +0000 (11:31 -0600)
http://tracker.ceph.com/issues/16049
Fixes: 16049
Signed-off-by: Zack Cerza <zack@redhat.com>
teuthology/task/pcp.py
teuthology/test/task/test_pcp.py

index c368936de65fb08f193cfdcc321f3e766c76337c..0c384b97e047fd1cdbe86af57cf572bc0ebb37d1 100644 (file)
@@ -310,8 +310,12 @@ class PCP(Task):
             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...")
index 3d4dde0cfe911a683a91620d98496f31eb3ae40b..0e13234029b58ffaa25c32cc4378c09d77b6f176 100644 (file)
@@ -1,7 +1,8 @@
 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
@@ -362,3 +363,18 @@ class TestPCPTask(TestTask):
         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)