Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(294)

Side by Side Diff: appengine/findit/model/flake/test/flake_swarming_task_test.py

Issue 2369333002: [Findit] Capture versionized metadata for master_flake_analysis (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 from datetime import datetime
6
5 import unittest 7 import unittest
6 8
7 from model.flake.flake_swarming_task import FlakeSwarmingTask 9 from model.flake.flake_swarming_task import FlakeSwarmingTask
8 10
9 11
10 class FlakeSwarmingTaskTest(unittest.TestCase): 12 class FlakeSwarmingTaskTest(unittest.TestCase):
11 13
12 def testStepTestName(self): 14 def testStepTestName(self):
13 task = FlakeSwarmingTask.Create('m', 'b', 121, 'browser_tests', 'test1') 15 task = FlakeSwarmingTask.Create('m', 'b', 121, 'browser_tests', 'test1')
14 self.assertEqual('browser_tests', task.step_name) 16 self.assertEqual('browser_tests', task.step_name)
15 self.assertEqual('test1', task.test_name) 17 self.assertEqual('test1', task.test_name)
18
19 def testResultsToDict(self):
20 master_name = 'm'
21 builder_name = 'b'
22 build_number = 121
23 step_name = 'browser_tests'
24 test_name = 'test1'
25 created_time = datetime(2016, 9, 26, 0, 0, 0, 0)
26 started_time = datetime(2016, 9, 26, 0, 1, 0, 0)
27 completed_time = datetime(2016, 9, 26, 0, 2, 0, 0)
28 number_of_iterations = 100
29 number_of_passes = 100
30
31 task = FlakeSwarmingTask.Create(
32 master_name, builder_name, build_number, step_name, test_name)
33 task.created_time = created_time
34 task.started_time = started_time
35 task.completed_time = completed_time
36 task.tries = number_of_iterations
37 task.successes = number_of_passes
38
39 expected_dict = {
40 'created_time': created_time,
41 'started_time': started_time,
42 'completed_time': completed_time,
43 'build_number': build_number,
44 'number_of_iterations': number_of_iterations,
45 'number_of_passes': number_of_passes
46 }
47
48 self.assertEqual(expected_dict, task.ResultsToDict())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698