示例#1
0
    def test_any_match(self):
        match_obj = {
            'table_group': 'histograms',
            'type': 'histogram',
            'name': {
                'any': ['foo', 'bar']
            }
        }

        probe_defn = {
            'name': 'not-matching-name',
            'type': 'histogram',
            'first_added': {
                'nightly': '2019-02-02 02:02:00'
            },
            'history': {
                'nightly': [{
                    'bug_numbers': [1351383],
                    'cpp_guard':
                    None,
                    'description':
                    'Whether we have layed out any display:block containers with '
                    'not-yet-supported properties from CSS Box Align.',
                    'details': {
                        'high': 2,
                        'keyed': False,
                        'kind': 'boolean',
                        'low': 1,
                        'n_buckets': 3,
                        'record_in_processes': ['main', 'content']
                    },
                    'expiry_version':
                    '57',
                    'notification_emails': ['*****@*****.**'],
                    'optout':
                    True,
                    'revisions': {
                        'first': 'f9605772a0c9098ed1bcaa98089b2c944ed69e9b',
                        'last': '8e818b5e9b6bef0fc1a5c527ecf30b0d56a02f14'
                    },
                    'versions': {
                        'first': '55',
                        'last': '57'
                    }
                }]
            }
        }

        matcher = Matcher(match_obj)
        probe = MainProbe('histogram/name', probe_defn)

        assert not matcher.matches(probe)

        probe_defn['name'] = 'foo'
        probe = MainProbe('histogram/name', probe_defn)
        assert matcher.matches(probe)

        probe_defn['name'] = 'bar'
        probe = MainProbe('histogram/name', probe_defn)
        assert matcher.matches(probe)
    def test_any_match(self):
        match_obj = {
            "table_group": "histograms",
            "type": "histogram",
            "name": {"any": ["foo", "bar"]},
        }

        probe_defn = {
            "name": "not-matching-name",
            "type": "histogram",
            "first_added": {"nightly": "2019-02-02 02:02:00"},
            "history": {
                "nightly": [
                    {
                        "bug_numbers": [1351383],
                        "cpp_guard": None,
                        "description": "Whether we have layed out any display:block "
                        "containers with not-yet-supported properties from CSS Box Align.",
                        "details": {
                            "high": 2,
                            "keyed": False,
                            "kind": "boolean",
                            "low": 1,
                            "n_buckets": 3,
                            "record_in_processes": ["main", "content"],
                        },
                        "expiry_version": "57",
                        "notification_emails": ["*****@*****.**"],
                        "optout": True,
                        "revisions": {
                            "first": "f9605772a0c9098ed1bcaa98089b2c944ed69e9b",
                            "last": "8e818b5e9b6bef0fc1a5c527ecf30b0d56a02f14",
                        },
                        "versions": {"first": "55", "last": "57"},
                    }
                ]
            },
        }

        matcher = Matcher(match_obj)
        probe = MainProbe("histogram/name", probe_defn)

        assert not matcher.matches(probe)

        probe_defn["name"] = "foo"
        probe = MainProbe("histogram/name", probe_defn)
        assert matcher.matches(probe)

        probe_defn["name"] = "bar"
        probe = MainProbe("histogram/name", probe_defn)
        assert matcher.matches(probe)
示例#3
0
 def test_main_probe_all_childs(self, main_probe_all_childs_defn):
     probe = MainProbe("scalar/test_probe", main_probe_all_childs_defn)
     assert probe.definition["details"]["record_in_processes"] == {
         "content",
         "gpu",
         "extension",
         "dynamic",
         "socket",
     }
示例#4
0
    def test_matches(self):
        match_obj = {
            'details': {
                'record_in_processes': {
                    'contains': 'main'
                },
                'keyed': True,
            },
            'table_group': 'keyed_scalars',
            'type': 'scalar',
        }

        probe_defn = {
            'name': 'temp_name',
            'type': 'scalar',
            'first_added': {
                'nightly': '2019-01-01 00:00:00'
            },
            'history': {
                'nightly': [{
                    'bug_numbers': [1522843],
                    'cpp_guard':
                    None,
                    'description':
                    'Number of times any text content from the Changes panel is '
                    'copied to the clipboard.\n',
                    'details': {
                        'keyed': True,
                        'kind': 'uint',
                        'record_in_processes': ['main']
                    },
                    'expiry_version':
                    '69',
                    'notification_emails':
                    ['*****@*****.**'],
                    'optout':
                    True,
                    'revisions': {
                        'first': '4ab143dde4dc3424cfedc74b3648fbf2e47fb7bf',
                        'last': '4ab143dde4dc3424cfedc74b3648fbf2e47fb7bf'
                    },
                    'versions': {
                        'first': '67',
                        'last': '67'
                    }
                }]
            }
        }

        matcher = Matcher(match_obj)
        probe = MainProbe("scalar/temp_name", probe_defn)
        assert matcher.matches(probe)
    def test_matches(self):
        match_obj = {
            "details": {"record_in_processes": {"contains": "main"}, "keyed": True},
            "table_group": "keyed_scalars",
            "type": "scalar",
        }

        probe_defn = {
            "name": "temp_name",
            "type": "scalar",
            "first_added": {"nightly": "2019-01-01 00:00:00"},
            "history": {
                "nightly": [
                    {
                        "bug_numbers": [1522843],
                        "cpp_guard": None,
                        "description": "Number of times any text content from the Changes panel is "
                        "copied to the clipboard.\n",
                        "details": {
                            "keyed": True,
                            "kind": "uint",
                            "record_in_processes": ["main"],
                        },
                        "expiry_version": "69",
                        "notification_emails": [
                            "*****@*****.**"
                        ],
                        "optout": True,
                        "revisions": {
                            "first": "4ab143dde4dc3424cfedc74b3648fbf2e47fb7bf",
                            "last": "4ab143dde4dc3424cfedc74b3648fbf2e47fb7bf",
                        },
                        "versions": {"first": "67", "last": "67"},
                    }
                ]
            },
        }

        matcher = Matcher(match_obj)
        probe = MainProbe("scalar/temp_name", probe_defn)
        assert matcher.matches(probe)
 def __init__(self, schema, env, probes):
     self.schema = Schema(schema)
     self.env = Schema(env)
     self.probes = [MainProbe(k, v) for k, v in probes.items()]
 def test_main_probe_all(self, main_probe_all_defn):
     probe = MainProbe("scalar/test_probe", main_probe_all_defn)
     assert probe.definition['details']['record_in_processes'] == \
         {"main", "content", "gpu", "extension", "dynamic", "socket"}
 def test_main_probe_processes(self, main_probe_defn):
     probe = MainProbe("scalar/test_probe", main_probe_defn)
     assert probe.definition['details']['record_in_processes'] == {
         "main", "content"
     }
 def test_main_sort(self, main_probe_defn):
     probe = MainProbe("scalar/test_probe", main_probe_defn)
     assert probe.definition['versions'] == main_probe_defn["history"][
         "nightly"][1]['versions']
示例#10
0
 def test_main_max_description_length(self,
                                      main_probe_max_description_length):
     probe = MainProbe("scalar/test_probe",
                       main_probe_max_description_length)
     assert len(probe.description) <= 1024
     assert probe.description == "x" * 1000 + "…"