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

        self.collector = UserScriptsCollector(config, None)
Beispiel #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
Beispiel #3
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)
Beispiel #4
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
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)
Beispiel #6
0
    def setUp(self):
        config = get_collector_config('UserScriptsCollector', {
            'interval': 10,
            'scripts_path': os.path.dirname(__file__) + '/fixtures/',
        })

        self.collector = UserScriptsCollector(config, None)
Beispiel #7
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()

        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)
Beispiel #8
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,
        })
Beispiel #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,
        })
Beispiel #10
0
    def setUp(self):
        config = get_collector_config(
            "UserScriptsCollector", {"interval": 10, "scripts_path": os.path.dirname(__file__) + "/fixtures/"}
        )

        self.collector = UserScriptsCollector(config, None)