コード例 #1
0
    def setUp(self):
        config = get_collector_config('UserScriptsCollector', {
            'interval': 10,
            'scripts_path': os.path.dirname(__file__) + '/fixtures/',
        })

        self.collector = UserScriptsCollector(config, None)
コード例 #2
0
class TestUserScriptsCollector(CollectorTestCase):
    def setUp(self):
        config = get_collector_config(
            'UserScriptsCollector', {
                'interval': 10,
                'scripts_path': os.path.dirname(__file__) + '/fixtures/',
            })

        self.collector = UserScriptsCollector(config, None)

    def test_import(self):
        self.assertTrue(UserScriptsCollector)

    @run_only_if_kitchen_is_available
    @patch.object(Collector, 'publish')
    def test_should_work_with_example(self, publish_mock):
        self.collector.collect()

        metrics = {
            'example.1': 42,
            'example.2': 24,
            'example.3': 12.1212,
        }

        self.setDocExample(collector=self.collector.__class__.__name__,
                           metrics=metrics)
        self.assertPublishedMany(publish_mock, metrics)

    @run_only_if_kitchen_is_available
    @patch.object(Collector, 'publish')
    def test_should_skip_over_unrunnable_files(self, publish_mock):
        self.collector.collect()
        # Just make sure publish got called >0 times, if this test fails it'll
        # be due to raising an exception. Meh.
        assert publish_mock.call_args_list
コード例 #3
0
ファイル: testuserscripts.py プロジェクト: tfeig/Diamond
class TestUserScriptsCollector(CollectorTestCase):
    def setUp(self):
        config = get_collector_config(
            'UserScriptsCollector', {
                'interval': 10,
                'scripts_path': os.path.dirname(__file__) + '/fixtures/',
            })

        self.collector = UserScriptsCollector(config, None)

    def test_import(self):
        self.assertTrue(UserScriptsCollector)

    @run_only_if_kitchen_is_available
    @patch.object(Collector, 'publish')
    def test_should_work_with_example(self, publish_mock):
        self.collector.collect()

        metrics = {
            'example.1': 42,
            'example.2': 24,
            'example.3': 12.1212,
        }

        self.setDocExample(collector=self.collector.__class__.__name__,
                           metrics=metrics)
        self.assertPublishedMany(publish_mock, metrics)
コード例 #4
0
ファイル: testuserscripts.py プロジェクト: 1and1/Diamond
class TestUserScriptsCollector(CollectorTestCase):
    def setUp(self):
        config = get_collector_config('UserScriptsCollector', {
            'interval': 10,
            'scripts_path': os.path.dirname(__file__) + '/fixtures/',
        })

        self.collector = UserScriptsCollector(config, None)

    def test_import(self):
        self.assertTrue(UserScriptsCollector)

    @run_only_if_kitchen_is_available
    @patch.object(Collector, 'publish')
    def test_should_work_with_example(self, publish_mock):
        self.collector.collect()

        metrics = {
            'example.1': 42,
            'example.2': 24,
            'example.3': 12.1212,
        }

        self.setDocExample(collector=self.collector.__class__.__name__,
                           metrics=metrics)
        self.assertPublishedMany(publish_mock, metrics)

    @run_only_if_kitchen_is_available
    @patch.object(Collector, 'publish')
    def test_should_skip_over_unrunnable_files(self, publish_mock):
        self.collector.collect()
        # Just make sure publish got called >0 times, if this test fails it'll
        # be due to raising an exception. Meh.
        assert publish_mock.call_args_list
コード例 #5
0
class TestUserScriptsCollector(CollectorTestCase):
    def setUp(self):
        config = get_collector_config('UserScriptsCollector', {
            'interval': 10,
            'scripts_path': os.path.dirname(__file__) + '/fixtures/',
        })

        self.collector = UserScriptsCollector(config, None)

    def test_import(self):
        self.assertTrue(UserScriptsCollector)

    @patch.object(Collector, 'publish')
    def test_should_work_with_example(self, publish_mock):
        self.collector.collect()

        metrics = {
            'example.1': 42,
            'example.2': 24,
            'example.3': 12.1212,
        }

        self.setDocExample(collector=self.collector.__class__.__name__,
                           metrics=metrics)
        self.assertPublishedMany(publish_mock, metrics)
コード例 #6
0
ファイル: testuserscripts.py プロジェクト: adreyer/Diamond
    def setUp(self):
        config = get_collector_config('UserScriptsCollector', {
            'interval': 10,
            'scripts_path': os.path.dirname(__file__) + '/fixtures/',
        })

        self.collector = UserScriptsCollector(config, None)
コード例 #7
0
ファイル: testuserscripts.py プロジェクト: songza/Diamond
class TestUserScriptsCollector(CollectorTestCase):
    def setUp(self):
        config = get_collector_config(
            "UserScriptsCollector", {"interval": 10, "scripts_path": os.path.dirname(__file__) + "/fixtures/"}
        )

        self.collector = UserScriptsCollector(config, None)

    @patch.object(Collector, "publish")
    def test_should_work_with_example(self, publish_mock):
        self.collector.collect()

        metrics = {"example.1": 42, "example.2": 24, "example.3": 12.1212}

        self.setDocExample(collector=self.collector.__class__.__name__, metrics=metrics)
        self.assertPublishedMany(publish_mock, metrics)
コード例 #8
0
ファイル: testuserscripts.py プロジェクト: kippandrew/Diamond
class TestUserScriptsCollector(CollectorTestCase):
    def setUp(self):
        config = get_collector_config('UserScriptsCollector', {
            'interval': 10,
            'scripts_path': os.path.dirname(__file__)+'/fixtures/',
        })

        self.collector = UserScriptsCollector(config, None)

    @patch.object(Collector, 'publish')
    def test_should_work_with_example(self, publish_mock):
        self.collector.collect()

        self.assertPublishedMany(publish_mock, {
            'example.1': 42, 
            'example.2': 24,
        })
コード例 #9
0
class TestUserScriptsCollector(CollectorTestCase):
    def setUp(self):
        config = get_collector_config(
            'UserScriptsCollector', {
                'interval': 10,
                'scripts_path': os.path.dirname(__file__) + '/fixtures/',
            })

        self.collector = UserScriptsCollector(config, None)

    @patch.object(Collector, 'publish')
    def test_should_work_with_example(self, publish_mock):
        self.collector.collect()

        self.assertPublishedMany(publish_mock, {
            'example.1': 42,
            'example.2': 24,
        })
コード例 #10
0
ファイル: testuserscripts.py プロジェクト: songza/Diamond
    def setUp(self):
        config = get_collector_config(
            "UserScriptsCollector", {"interval": 10, "scripts_path": os.path.dirname(__file__) + "/fixtures/"}
        )

        self.collector = UserScriptsCollector(config, None)