Bug 1497575: [staging-release] Fix tryselect tests for changed json formatting; r=ahal
authorTom Prince <mozilla@hocat.ca>
Fri, 19 Oct 2018 13:28:50 +0000
changeset 500671 55bd63e9f1142c61581900052713d5495012405a
parent 500670 cf105c387f2dc5053f26f0cb4429b97982d6fb65
child 500672 e688352c431d7a3daedd22f0243e9c10e25cf399
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersahal
bugs1497575
milestone64.0a1
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
Bug 1497575: [staging-release] Fix tryselect tests for changed json formatting; r=ahal Differential Revision: https://phabricator.services.mozilla.com/D9153
tools/tryselect/push.py
tools/tryselect/test/test_empty.t
tools/tryselect/test/test_fuzzy.t
tools/tryselect/test/test_message.t
tools/tryselect/test/test_preset.t
--- a/tools/tryselect/push.py
+++ b/tools/tryselect/push.py
@@ -47,17 +47,17 @@ vcs = get_repository_object(build.topsrc
 topsrcdir_hash = hashlib.sha256(os.path.abspath(build.topsrcdir)).hexdigest()
 history_path = os.path.join(get_state_dir()[0], 'history', topsrcdir_hash, 'try_task_configs.json')
 old_history_path = os.path.join(get_state_dir()[0], 'history', 'try_task_configs.json')
 
 
 def write_task_config(try_task_config):
     config_path = os.path.join(vcs.path, 'try_task_config.json')
     with open(config_path, 'w') as fh:
-        json.dump(try_task_config, fh, indent=4, separators=(',', ': '))
+        json.dump(try_task_config, fh, indent=4, separators=(',', ': '), sort_keys=True)
         fh.write('\n')
     return config_path
 
 
 def write_task_config_history(msg, try_task_config):
     if not os.path.isfile(history_path):
         if not os.path.isdir(os.path.dirname(history_path)):
             os.makedirs(os.path.dirname(history_path))
--- a/tools/tryselect/test/test_empty.t
+++ b/tools/tryselect/test/test_empty.t
@@ -5,31 +5,34 @@ Test empty selector
 
   $ ./mach try empty --no-push
   Commit message:
   No try selector specified, use "Add New Jobs" to select tasks.
   
   Pushed via `mach try empty`
   Calculated try_task_config.json:
   {
-    "tasks":[]
+      "tasks": [],
+      "version": 1
   }
   
   $ ./mach try empty --no-push --closed-tree
   Commit message:
   No try selector specified, use "Add New Jobs" to select tasks. ON A CLOSED TREE
   
   Pushed via `mach try empty`
   Calculated try_task_config.json:
   {
-    "tasks":[]
+      "tasks": [],
+      "version": 1
   }
   
   $ ./mach try empty --no-push --closed-tree -m "foo {msg} bar"
   Commit message:
   foo No try selector specified, use "Add New Jobs" to select tasks. bar ON A CLOSED TREE
   
   Pushed via `mach try empty`
   Calculated try_task_config.json:
   {
-    "tasks":[]
+      "tasks": [],
+      "version": 1
   }
   
--- a/tools/tryselect/test/test_fuzzy.t
+++ b/tools/tryselect/test/test_fuzzy.t
@@ -5,87 +5,92 @@ Test fuzzy selector
 
   $ ./mach try fuzzy $testargs -q "'foo"
   Commit message:
   Fuzzy query='foo
   
   Pushed via `mach try fuzzy`
   Calculated try_task_config.json:
   {
-    "tasks":[
-      "test/foo-debug",
-      "test/foo-opt"
-    ]
+      "tasks": [
+          "test/foo-debug",
+          "test/foo-opt"
+      ],
+      "version": 1
   }
   
   $ ./mach try fuzzy $testargs -q "'bar"
   no tasks selected
   $ ./mach try fuzzy $testargs --full -q "'bar"
   Commit message:
   Fuzzy query='bar
   
   Pushed via `mach try fuzzy`
   Calculated try_task_config.json:
   {
-    "tasks":[
-      "test/bar-debug",
-      "test/bar-opt"
-    ]
+      "tasks": [
+          "test/bar-debug",
+          "test/bar-opt"
+      ],
+      "version": 1
   }
   
 
 Test multiple selectors
 
   $ ./mach try fuzzy $testargs --full -q "'foo" -q "'bar"
   Commit message:
   Fuzzy query='foo&query='bar
   
   Pushed via `mach try fuzzy`
   Calculated try_task_config.json:
   {
-    "tasks":[
-      "test/bar-debug",
-      "test/bar-opt",
-      "test/foo-debug",
-      "test/foo-opt"
-    ]
+      "tasks": [
+          "test/bar-debug",
+          "test/bar-opt",
+          "test/foo-debug",
+          "test/foo-opt"
+      ],
+      "version": 1
   }
   
 
 Test templates
 
   $ ./mach try fuzzy --no-push --artifact -q "'foo"
   Commit message:
   Fuzzy query='foo
   
   Pushed via `mach try fuzzy`
   Calculated try_task_config.json:
   {
-    "templates":{
-      "artifact":{
-        "enabled":"1"
-      }
-    },
-    "tasks":[
-      "test/foo-debug",
-      "test/foo-opt"
-    ]
+      "tasks": [
+          "test/foo-debug",
+          "test/foo-opt"
+      ],
+      "templates": {
+          "artifact": {
+              "enabled": "1"
+          }
+      },
+      "version": 1
   }
   
   $ ./mach try fuzzy $testargs --env FOO=1 --env BAR=baz -q "'foo"
   Commit message:
   Fuzzy query='foo
   
   Pushed via `mach try fuzzy`
   Calculated try_task_config.json:
   {
-    "templates":{
-      "env":{
-        "FOO":"1",
-        "BAR":"baz"
-      }
-    },
-    "tasks":[
-      "test/foo-debug",
-      "test/foo-opt"
-    ]
+      "tasks": [
+          "test/foo-debug",
+          "test/foo-opt"
+      ],
+      "templates": {
+          "env": {
+              "BAR": "baz",
+              "FOO": "1"
+          }
+      },
+      "version": 1
   }
   
--- a/tools/tryselect/test/test_message.t
+++ b/tools/tryselect/test/test_message.t
@@ -7,33 +7,35 @@ Test custom commit messages with fuzzy s
   Commit message:
   Foobar
   
   Fuzzy query=foo
   
   Pushed via `mach try fuzzy`
   Calculated try_task_config.json:
   {
-    "tasks":[
-      "test/foo-debug",
-      "test/foo-opt"
-    ]
+      "tasks": [
+          "test/foo-debug",
+          "test/foo-opt"
+      ],
+      "version": 1
   }
   
   $ ./mach try fuzzy $testargs -q foo -m "Foobar: {msg}"
   Commit message:
   Foobar: Fuzzy query=foo
   
   Pushed via `mach try fuzzy`
   Calculated try_task_config.json:
   {
-    "tasks":[
-      "test/foo-debug",
-      "test/foo-opt"
-    ]
+      "tasks": [
+          "test/foo-debug",
+          "test/foo-opt"
+      ],
+      "version": 1
   }
   
   $ unset EDITOR
   $ ./mach try fuzzy $testargs -q foo -m > /dev/null 2>&1
   [2]
 
 
 Test custom commit messages with syntax selector
--- a/tools/tryselect/test/test_preset.t
+++ b/tools/tryselect/test/test_preset.t
@@ -68,58 +68,62 @@ Test preset with fuzzy subcommand
   $ ./mach try fuzzy $testargs --save baz -q "'baz"
   preset saved, run with: --preset=baz
   Commit message:
   Fuzzy query='baz
   
   Pushed via `mach try fuzzy`
   Calculated try_task_config.json:
   {
-    "tasks":[
-      "build-baz"
-    ]
+      "tasks": [
+          "build-baz"
+      ],
+      "version": 1
   }
   
   $ ./mach try fuzzy $testargs --preset baz
   Commit message:
   Fuzzy query='baz
   
   Pushed via `mach try fuzzy`
   Calculated try_task_config.json:
   {
-    "tasks":[
-      "build-baz"
-    ]
+      "tasks": [
+          "build-baz"
+      ],
+      "version": 1
   }
   
 
   $ ./mach try fuzzy $testargs --preset baz -q "'foo"
   Commit message:
   Fuzzy query='foo&query='baz
   
   Pushed via `mach try fuzzy`
   Calculated try_task_config.json:
   {
-    "tasks":[
-      "build-baz",
-      "test/foo-debug",
-      "test/foo-opt"
-    ]
+      "tasks": [
+          "build-baz",
+          "test/foo-debug",
+          "test/foo-opt"
+      ],
+      "version": 1
   }
   
   $ ./mach try $testargs --preset baz
   Commit message:
   Fuzzy query='baz
   
   Pushed via `mach try fuzzy`
   Calculated try_task_config.json:
   {
-    "tasks":[
-      "build-baz"
-    ]
+      "tasks": [
+          "build-baz"
+      ],
+      "version": 1
   }
   
   $ ./mach try fuzzy $testargs --list-presets
   baz: 'baz
   $ ./mach try fuzzy $testargs --edit-presets
   [try]
   foo = -b do -p linux -u mochitests -t none --tag foo
   bar = -b do -p win32 -u none -t all --tag bar