def test_not_and_contains(self): match_obj = { 'send_in_pings': { 'not': ['baseline'], 'contains': 'baseline' }, 'table_group': 'histograms', 'type': 'histogram' } probe_defn = { 'name': 'test-name', 'type': 'histogram', 'first_added': { 'nightly': '2019-02-02 02:02:00' }, 'history': [{ '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.', 'send_in_pings': ['baseline', 'event'], 'details': { 'high': 2, 'keyed': False, 'kind': 'boolean', 'low': 1, 'n_buckets': 3, 'record_in_processes': ['main', 'content'] }, 'expiry_version': '57', 'notification_emails': ['*****@*****.**'], 'optout': True, 'commits': { 'first': 'f9605772a0c9098ed1bcaa98089b2c944ed69e9b', 'last': '8e818b5e9b6bef0fc1a5c527ecf30b0d56a02f14' }, 'dates': { 'first': '2018-01-01 00:00:00', 'last': '2019-01-01 00:00:00' } }] } matcher = Matcher(match_obj) probe = GleanProbe('histogram/name', probe_defn) assert matcher.matches(probe) probe_defn['history'][0]['send_in_pings'] = ['baseline'] probe = GleanProbe('histogram/name', probe_defn) assert not matcher.matches(probe)
def test_not_and_contains(self): match_obj = { "send_in_pings": {"not": ["baseline"], "contains": "baseline"}, "table_group": "histograms", "type": "histogram", } probe_defn = { "name": "test-name", "type": "histogram", "first_added": {"nightly": "2019-02-02 02:02:00"}, "history": [ { "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.", "send_in_pings": ["baseline", "event"], "details": { "high": 2, "keyed": False, "kind": "boolean", "low": 1, "n_buckets": 3, "record_in_processes": ["main", "content"], }, "expiry_version": "57", "notification_emails": ["*****@*****.**"], "optout": True, "commits": { "first": "f9605772a0c9098ed1bcaa98089b2c944ed69e9b", "last": "8e818b5e9b6bef0fc1a5c527ecf30b0d56a02f14", }, "dates": { "first": "2018-01-01 00:00:00", "last": "2019-01-01 00:00:00", }, } ], } matcher = Matcher(match_obj) probe = GleanProbe("histogram/name", probe_defn) assert matcher.matches(probe) probe_defn["history"][0]["send_in_pings"] = ["baseline"] probe = GleanProbe("histogram/name", probe_defn) assert not matcher.matches(probe)
def get_probes(self) -> List[GleanProbe]: probe_defn = { "history": [ { "description": "Glean URL test description", "dates": { "first": "2019-04-12 13:44:13", "last": "2019-08-08 15:34:03", }, "send_in_pings": ["metrics"], }, ], "name": "my_url", "type": "url", "in-source": False, } probe = GleanProbe("metrics", probe_defn, pings=["metrics"]) return [p for p in super().get_probes()] + [probe]
def test_glean_subset_of_pings(self, glean_probe_defn_subset_pings): pings = ["ping1", "ping2", "ping3"] probe = GleanProbe("scalar/test_probe", glean_probe_defn_subset_pings, pings=pings) assert probe.definition["send_in_pings"] == {"baseline", "metrics"}
def test_glean_all_pings(self, glean_probe_defn): pings = ["ping1", "ping2", "ping3"] probe = GleanProbe("scalar/test_probe", glean_probe_defn, pings=pings) assert probe.definition["send_in_pings"] == set(pings)
def test_glean_sort(self, glean_probe_defn): probe = GleanProbe("scalar/test_probe", glean_probe_defn, pings=["aping"]) assert probe.definition == glean_probe_defn["history"][1]