Backed out 2 changesets (bug 1456415) for bustage in \toolkit\components\telemetry\tests\python\test_gen_event_data_json.py on a CLOSED TREE
authorMargareta Eliza Balazs <ebalazs@mozilla.com>
Fri, 04 May 2018 14:21:11 +0300
changeset 473010 426038e8d7577f4a2b02435e27d2cddbdbab98bb
parent 473009 d0ea1b6b6dfb1e1e5e5edaa64bbf09bee22367c2
child 473011 2fa3d76f8cee1b47d4c473e73390dce597c998fd
push id1728
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:12:27 +0000
treeherdermozilla-release@c296fde26f5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1456415
milestone61.0a1
backs out6b8dadbdc7d0cba584dc9d3665c7b4b8341bffa2
2bc9caa50c3b6ba52fa1749ea291894bf6cc6223
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out 2 changesets (bug 1456415) for bustage in \toolkit\components\telemetry\tests\python\test_gen_event_data_json.py on a CLOSED TREE Backed out changeset 6b8dadbdc7d0 (bug 1456415) Backed out changeset 2bc9caa50c3b (bug 1456415)
toolkit/components/telemetry/gen_event_data.py
toolkit/components/telemetry/gen_scalar_data.py
toolkit/components/telemetry/parse_events.py
toolkit/components/telemetry/parse_scalars.py
toolkit/components/telemetry/tests/python/python.ini
toolkit/components/telemetry/tests/python/test_gen_event_data_json.py
toolkit/components/telemetry/tests/python/test_gen_scalar_data_json.py
--- a/toolkit/components/telemetry/gen_event_data.py
+++ b/toolkit/components/telemetry/gen_event_data.py
@@ -133,17 +133,17 @@ def generate_JSON_definitions(output, *f
 
         if category not in event_definitions:
             event_definitions[category] = OrderedDict()
 
         event_definitions[category][event.name] = OrderedDict({
             'methods': event.methods,
             'objects': event.objects,
             'extra_keys': event.extra_keys,
-            'record_on_release': True if event.dataset_short == 'opt-out' else False,
+            'record_on_release': True if event.dataset == 'opt-out' else False,
             # We don't expire dynamic-builtin scalars: they're only meant for
             # use in local developer builds anyway. They will expire when rebuilding.
             'expired': False,
         })
 
     json.dump(event_definitions, output)
 
 
--- a/toolkit/components/telemetry/gen_scalar_data.py
+++ b/toolkit/components/telemetry/gen_scalar_data.py
@@ -105,17 +105,17 @@ def generate_JSON_definitions(output, *f
         category = scalar.category
 
         if category not in scalar_definitions:
             scalar_definitions[category] = OrderedDict()
 
         scalar_definitions[category][scalar.name] = OrderedDict({
             'kind': scalar.nsITelemetry_kind,
             'keyed': scalar.keyed,
-            'record_on_release': True if scalar.dataset_short == 'opt-out' else False,
+            'record_on_release': True if scalar.dataset == 'opt-out' else False,
             # We don't expire dynamic-builtin scalars: they're only meant for
             # use in local developer builds anyway. They will expire when rebuilding.
             'expired': False,
         })
 
     json.dump(scalar_definitions, output)
 
 
--- a/toolkit/components/telemetry/parse_events.py
+++ b/toolkit/components/telemetry/parse_events.py
@@ -266,31 +266,23 @@ class EventData:
             return m + '_' + o
         combinations = itertools.product(self.methods, self.objects)
         return [enum(t[0], t[1]) for t in combinations]
 
     @property
     def dataset(self):
         """Get the nsITelemetry constant equivalent for release_channel_collection.
         """
-        rcc = self.dataset_short
+        rcc = self._definition.get('release_channel_collection', 'opt-in')
         if rcc == 'opt-out':
             return 'nsITelemetry::DATASET_RELEASE_CHANNEL_OPTOUT'
         else:
             return 'nsITelemetry::DATASET_RELEASE_CHANNEL_OPTIN'
 
     @property
-    def dataset_short(self):
-        """Get the short name of the chosen release channel collection policy for the event.
-        """
-        # The collection policy is optional, but we still define a default
-        # behaviour for it.
-        return self._definition.get('release_channel_collection', 'opt-in')
-
-    @property
     def extra_keys(self):
         return self._definition.get('extra_keys', {}).keys()
 
 
 def load_events(filename, strict_type_checks):
     """Parses a YAML file containing the event definitions.
 
     :param filename: the YAML file containing the event definitions.
--- a/toolkit/components/telemetry/parse_scalars.py
+++ b/toolkit/components/telemetry/parse_scalars.py
@@ -271,35 +271,29 @@ class ScalarType:
 
     @property
     def record_in_processes_enum(self):
         """Get the non-empty list of flags representing the processes to record data in"""
         return [utils.process_name_to_enum(p) for p in self.record_in_processes]
 
     @property
     def dataset(self):
-        """Get the nsITelemetry constant equivalent to the chosen release channel collection
+        """Get the nsITelemetry constant equivalent to the chose release channel collection
         policy for the scalar.
         """
-        rcc = self.dataset_short
+        # The collection policy is optional, but we still define a default
+        # behaviour for it.
+        rcc = self._definition.get('release_channel_collection', 'opt-in')
         table = {
             'opt-in': 'OPTIN',
             'opt-out': 'OPTOUT',
         }
         return 'nsITelemetry::DATASET_RELEASE_CHANNEL_' + table[rcc]
 
     @property
-    def dataset_short(self):
-        """Get the short name of the chosen release channel collection policy for the scalar.
-        """
-        # The collection policy is optional, but we still define a default
-        # behaviour for it.
-        return self._definition.get('release_channel_collection', 'opt-in')
-
-    @property
     def cpp_guard(self):
         """Get the cpp guard for this scalar"""
         return self._definition.get('cpp_guard')
 
 
 def load_scalars(filename, strict_type_checks=True):
     """Parses a YAML file containing the scalar definition.
 
--- a/toolkit/components/telemetry/tests/python/python.ini
+++ b/toolkit/components/telemetry/tests/python/python.ini
@@ -1,4 +1,2 @@
-[test_gen_event_data_json.py]
-[test_gen_scalar_data_json.py]
 [test_histogramtools_non_strict.py]
-[test_histogramtools_strict.py]
+[test_histogramtools_strict.py]
\ No newline at end of file
deleted file mode 100644
--- a/toolkit/components/telemetry/tests/python/test_gen_event_data_json.py
+++ /dev/null
@@ -1,83 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-import json
-import mozunit
-import sys
-import tempfile
-import unittest
-from StringIO import StringIO
-from os import path
-
-TELEMETRY_ROOT_PATH = path.abspath(path.join(path.dirname(__file__), path.pardir, path.pardir))
-sys.path.append(TELEMETRY_ROOT_PATH)
-import gen_event_data   # noqa: E402
-
-
-class TestEventDataJson(unittest.TestCase):
-
-    def test_JSON_definitions_generation(self):
-        EVENTS_YAML = """
-with.optout:
-  testme1:
-    objects: ["test1"]
-    bug_numbers: [1456415]
-    notification_emails: ["telemetry-client-dev@mozilla.org"]
-    record_in_processes: ["main"]
-    description: opt-out event
-    release_channel_collection: opt-out
-    expiry_version: never
-    extra_keys:
-      message: a message 1
-with.optin:
-  testme2:
-    objects: ["test2"]
-    bug_numbers: [1456415]
-    notification_emails: ["telemetry-client-dev@mozilla.org"]
-    record_in_processes: ["main"]
-    description: opt-in event
-    release_channel_collection: opt-in
-    expiry_version: never
-    extra_keys:
-      message: a message 2
-        """
-
-        EXPECTED_JSON = {
-            "with.optout": {
-                "testme1": {
-                    "objects": ["test1"],
-                    "expired": False,
-                    "methods": ["testme1"],
-                    "extra_keys": ["message"],
-                    "record_on_release": True
-                }
-            },
-            "with.optin": {
-                "testme2": {
-                    "objects": ["test2"],
-                    "expired": False,
-                    "methods": ["testme2"],
-                    "extra_keys": ["message"],
-                    "record_on_release": False
-                }
-            },
-        }
-
-        io = StringIO()
-        with tempfile.NamedTemporaryFile(suffix=".json", delete=True) as tmpfile:
-            # Write the event definition to the temporary file
-            tmpfile.write(EVENTS_YAML)
-            tmpfile.flush()
-
-            # Let the parser generate the artifact definitions
-            gen_event_data.generate_JSON_definitions(io, tmpfile.name)
-
-        event_definitions = json.loads(io.getvalue())
-
-        # Check that it generated the correct data
-        self.assertEqual(EXPECTED_JSON, event_definitions)
-
-
-if __name__ == '__main__':
-    mozunit.main()
deleted file mode 100644
--- a/toolkit/components/telemetry/tests/python/test_gen_scalar_data_json.py
+++ /dev/null
@@ -1,78 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-import json
-import mozunit
-import sys
-import tempfile
-import unittest
-from StringIO import StringIO
-from os import path
-
-TELEMETRY_ROOT_PATH = path.abspath(path.join(path.dirname(__file__), path.pardir, path.pardir))
-sys.path.append(TELEMETRY_ROOT_PATH)
-import gen_scalar_data   # noqa: E402
-
-
-class TestScalarDataJson(unittest.TestCase):
-
-    def test_JSON_definitions_generation(self):
-        SCALARS_YAML = """
-newscalar:
-  withoptin:
-    bug_numbers:
-      - 1456415
-    description: opt-in scalar
-    expires: never
-    kind: uint
-    notification_emails: ["telemetry-client-dev@mozilla.org"]
-    record_in_processes: ["main"]
-    release_channel_collection: opt-in
-    keyed: false
-  withoptout:
-    bug_numbers:
-      - 1456415
-    description: opt-out scalar
-    expires: never
-    kind: string
-    notification_emails: ["telemetry-client-dev@mozilla.org"]
-    record_in_processes: ["main"]
-    release_channel_collection: opt-out
-    keyed: false
-        """
-
-        EXPECTED_JSON = {
-            "newscalar": {
-                "withoptout": {
-                    "kind": "nsITelemetry::SCALAR_TYPE_STRING",
-                    "expired": False,
-                    "record_on_release": True,
-                    "keyed": False
-                },
-                "withoptin": {
-                    "kind": "nsITelemetry::SCALAR_TYPE_COUNT",
-                    "expired": False,
-                    "record_on_release": False,
-                    "keyed": False
-                }
-            }
-        }
-
-        io = StringIO()
-        with tempfile.NamedTemporaryFile(suffix=".json", delete=True) as tmpfile:
-            # Write the scalar definition to the temporary file
-            tmpfile.write(SCALARS_YAML)
-            tmpfile.flush()
-
-            # Let the parser generate the artifact definitions
-            gen_scalar_data.generate_JSON_definitions(io, tmpfile.name)
-
-        scalar_definitions = json.loads(io.getvalue())
-
-        # Check that it generated the correct data
-        self.assertEqual(EXPECTED_JSON, scalar_definitions)
-
-
-if __name__ == '__main__':
-    mozunit.main()