コード例 #1
0
    def test_select_prometheus_node_targets(self):
        expected_targets = [{
            'labels': {
                'machine': 'mlab2.abc01.measurement-lab.org'
            },
            'targets': ['mlab2.abc01.measurement-lab.org:9090']
        }]

        actual_targets = mlabconfig.select_prometheus_node_targets(
            self.sites, "mlab2.*", '{{hostname}}:9090', {})

        self.assertEqual(len(actual_targets), 1)
        self.assertItemsEqual(actual_targets, expected_targets)
コード例 #2
0
ファイル: mlabconfig_test.py プロジェクト: m-lab/siteinfo
    def test_select_prometheus_node_targets_decorated_names(self):
        expected_targets = [{
            'labels': {
                'ipv6': 'present',
                'machine': 'mlab1.abc01.measurement-lab.org'
            },
            'targets': ['mlab1v6.abc01.measurement-lab.org:9090']
        }]

        actual_targets = mlabconfig.select_prometheus_node_targets(
            self.sites, "mlab-sandbox", "mlab1.*", ['{{hostname}}:9090'], {},
            'v6', False)

        self.assertEqual(len(actual_targets), 1)
        self.assertCountEqual(actual_targets, expected_targets)
コード例 #3
0
    def test_select_prometheus_node_targets(self):
        expected_targets = [
            {
                'labels': {
                    'machine': 'mlab2.abc01.measurement-lab.org'
                },
                'targets': [
                    'mlab2.abc01.measurement-lab.org:9090'
                ]
            }
        ]

        actual_targets = mlabconfig.select_prometheus_node_targets(
            self.sites, "mlab2.*", ['{{hostname}}:9090'], {})

        self.assertEqual(len(actual_targets), 1)
        self.assertItemsEqual(actual_targets, expected_targets)
コード例 #4
0
ファイル: mlabconfig_test.py プロジェクト: m-lab/siteinfo
    def test_select_prometheus_node_targets_ipv6_disabled(self):
        expected_targets = [{
            'labels': {
                'ipv6': 'missing',
                'machine': 'mlab1.abc01.measurement-lab.org'
            },
            'targets': ['mlab1.abc01.measurement-lab.org:9090']
        }]

        sites_ipv6_disabled = sites
        sites_ipv6_disabled[0]['nodes'][0]['v6']['ip'] = ""

        actual_targets = mlabconfig.select_prometheus_node_targets(
            sites_ipv6_disabled, "mlab-sandbox", "mlab1.*",
            ['{{hostname}}:9090'], {}, '', False)

        self.assertEqual(len(actual_targets), 1)
        self.assertCountEqual(actual_targets, expected_targets)
        self.assertEqual(actual_targets[0]['labels']['ipv6'], "missing")
コード例 #5
0
ファイル: mlabconfig_test.py プロジェクト: m-lab/siteinfo
    def test_select_prometheus_node_targets_excludes_unselected_project(self):
        actual_targets = mlabconfig.select_prometheus_node_targets(
            self.sites, "mlab-oti", "mlab1.*", ['{{hostname}}:9090'], {}, '',
            False)

        self.assertEqual(len(actual_targets), 0)