Merge lp:~joetalbott/utah/fix_result_counts into lp:utah

Proposed by Joe Talbott
Status: Merged
Approved by: Javier Collado
Approved revision: 770
Merged at revision: 768
Proposed branch: lp:~joetalbott/utah/fix_result_counts
Merge into: lp:utah
Diff against target: 678 lines (+432/-76)
9 files modified
tests/test_parser.py (+5/-2)
utah/client/examples/test_state_partial_all_failed.yaml (+90/-0)
utah/client/examples/test_state_partial_inprogress.yaml (+90/-0)
utah/client/examples/test_state_partial_run_all.yaml (+90/-0)
utah/client/runner.py (+12/-11)
utah/client/testcase.py (+10/-5)
utah/client/tests/common.py (+27/-0)
utah/client/tests/test_state_agent.py (+102/-55)
utah/client/testsuite.py (+6/-3)
To merge this branch: bzr merge lp:~joetalbott/utah/fix_result_counts
Reviewer Review Type Date Requested Status
Joe Talbott (community) Needs Resubmitting
Javier Collado (community) Approve
Review via email: mp+137337@code.launchpad.net

Description of the change

This branch fixes the result counts for runs that involve a reboot.

To post a comment you must log in.
767. By Joe Talbott

test_state_agent - Add a few more tests for resumes.

* make sure different scenarios return the expected results.

Revision history for this message
Javier Collado (javier.collado) wrote :

I've got a couple of questions:
- What does JAT stand for? I'd prefer all those commented lines to be removed.
- Why is there a long yaml file embedded in the code? I think maintenance would be easier if the file was in a separate location on its own.

review: Needs Information
768. By Joe Talbott

testcase - Remove leftover commented out code.

769. By Joe Talbott

tests - Move YAML content into separtate files.

Revision history for this message
Joe Talbott (joetalbott) wrote :

I've removed those commented out line. I meant to do that before pushing but forgot.

I also moved the YAML content into separate files.

review: Needs Resubmitting
Revision history for this message
Javier Collado (javier.collado) wrote :

Looks nice now. Thanks!

review: Approve
Revision history for this message
Javier Collado (javier.collado) wrote :

By the way, when running the test cases, I get three errors like the one below:

======================================================================
ERROR: Failure: TypeError (__init__() takes at least 4 arguments (1 given))
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/nose/loader.py", line 495, in makeTest
    return self._makeTest(obj, parent)
  File "/usr/lib/python2.7/dist-packages/nose/loader.py", line 554, in _makeTest
    return MethodTestCase(obj)
  File "/usr/lib/python2.7/dist-packages/nose/case.py", line 345, in __init__
    self.inst = self.cls()
TypeError: __init__() takes at least 4 arguments (1 given)
----------------------------------------------------------------------

I get them for the dev branch as well, so I don't think it's because of any
change here. Anyway, I'm not merging this right now just in case you want to
take a look a this issue.

770. By Joe Talbott

parser - Fix test for malformed yaml file.

Revision history for this message
Joe Talbott (joetalbott) wrote :

It was an unrelated issue, but I went ahead and fixed it here.

review: Needs Resubmitting
Revision history for this message
Javier Collado (javier.collado) wrote :

Actually, I've found that the problem was on my side when running the test
cases.

Instead of passing `utah/client/tests`, I was passing just `utah/client`. The
side effect of this was that `nosetests` believed that there were some test
cases in `utah/client/testsuite.py` and tried to execute them causing the
backtrace in my previous comment.

Anyway, merging your changes.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/test_parser.py'
2--- tests/test_parser.py 2012-11-14 22:10:40 +0000
3+++ tests/test_parser.py 2012-12-05 15:31:21 +0000
4@@ -3,7 +3,7 @@
5 import tempfile
6 import unittest
7
8-from utah.parser import UTAHParser
9+from utah.parser import UTAHParser, ParserError
10
11 MALFORMED_CONTENT = """
12 ---
13@@ -22,6 +22,9 @@
14
15 self.tmpfile.write(MALFORMED_CONTENT)
16
17+ # reset the stream for later reading.
18+ self.tmpfile.seek(0)
19+
20 def tearDown(self):
21 self.tmpfile.close()
22
23@@ -30,7 +33,7 @@
24 data = self.parser.parse(self.fakelog)
25
26 def test_malformed_file(self):
27- with self.assertRaises(jsonschema.ValidationError):
28+ with self.assertRaises(ParserError):
29 data = self.parser.parse(self.tmpfile)
30
31 def test_parser(self):
32
33=== added file 'utah/client/examples/test_state_partial_all_failed.yaml'
34--- utah/client/examples/test_state_partial_all_failed.yaml 1970-01-01 00:00:00 +0000
35+++ utah/client/examples/test_state_partial_all_failed.yaml 2012-12-05 15:31:21 +0000
36@@ -0,0 +1,90 @@
37+master_runlist: /var/lib/utah/master.run
38+status: RUN
39+result_class: !!python/name:utah.client.result.ResultYAML ''
40+fetched_suites:
41+- examples
42+- utah_tests
43+- utah_tests_sample
44+suites:
45+- build_cmd: null
46+ name: examples
47+ passes: 0
48+ errors: 0
49+ failures: 2
50+ status: DONE
51+ tests:
52+ - build_cmd: echo "building for test_one"
53+ command: python test_one.py
54+ description: A first sample test case.
55+ name: test_one
56+ path: examples/test_one
57+ status: DONE
58+ summary: FAIL
59+ tc_cleanup: echo "cleanup for test_one"
60+ tc_setup: echo "setup for test_one"
61+ timeout: 3
62+ type: userland
63+ - build_cmd: echo "building for test_two"
64+ command: python test_two.py
65+ description: A second sample test case.
66+ name: test_two
67+ path: examples/test_two
68+ status: DONE
69+ summary: FAIL
70+ tc_cleanup: echo "cleanup for test_two"
71+ tc_setup: echo "setup for test_two"
72+ timeout: 300
73+ type: userland
74+- build_cmd: null
75+ name: utah_tests
76+ passes: 0
77+ errors: 0
78+ failures: 2
79+ status: DONE
80+ tests:
81+ - build_cmd: echo "building for test_one"
82+ command: python test_one.py
83+ description: A first sample test case.
84+ name: test_one
85+ path: utah_tests/test_one
86+ status: DONE
87+ summary: FAIL
88+ tc_cleanup: echo "cleanup for test_one"
89+ tc_setup: echo "setup for test_one"
90+ timeout: 3
91+ type: userland
92+ - build_cmd: echo "building for test_two"
93+ command: python test_two.py
94+ description: A second sample test case.
95+ name: test_two
96+ path: utah_tests/test_two
97+ status: DONE
98+ summary: FAIL
99+ tc_cleanup: echo "cleanup for test_two"
100+ tc_setup: echo "setup for test_two"
101+ timeout: 300
102+ type: userland
103+ timeout: 0
104+ ts_cleanup: null
105+ ts_setup: null
106+- build_cmd: null
107+ name: utah_tests_sample
108+ passes: 0
109+ errors: 0
110+ failures: 1
111+ status: DONE
112+ tests:
113+ - build_cmd: echo "building for sample_one"
114+ command: python sample.py
115+ description: A sample test case.
116+ name: sample_one
117+ path: utah_tests_sample/sample_one
118+ status: DONE
119+ summary: FAIL
120+ tc_cleanup: echo "cleanup for sample_one"
121+ tc_setup: echo "setup for sample_one"
122+ timeout: 200
123+ type: userland
124+ timeout: 0
125+ ts_cleanup: null
126+ ts_setup: null
127
128=== added file 'utah/client/examples/test_state_partial_inprogress.yaml'
129--- utah/client/examples/test_state_partial_inprogress.yaml 1970-01-01 00:00:00 +0000
130+++ utah/client/examples/test_state_partial_inprogress.yaml 2012-12-05 15:31:21 +0000
131@@ -0,0 +1,90 @@
132+master_runlist: /var/lib/utah/master.run
133+status: RUN
134+result_class: !!python/name:utah.client.result.ResultYAML ''
135+fetched_suites:
136+- examples
137+- utah_tests
138+- utah_tests_sample
139+suites:
140+- build_cmd: null
141+ name: examples
142+ passes: 2
143+ errors: 0
144+ failures: 0
145+ status: DONE
146+ tests:
147+ - build_cmd: echo "building for test_one"
148+ command: python test_one.py
149+ description: A first sample test case.
150+ name: test_one
151+ path: examples/test_one
152+ status: DONE
153+ summary: PASS
154+ tc_cleanup: echo "cleanup for test_one"
155+ tc_setup: echo "setup for test_one"
156+ timeout: 3
157+ type: userland
158+ - build_cmd: echo "building for test_two"
159+ command: python test_two.py
160+ description: A second sample test case.
161+ name: test_two
162+ path: examples/test_two
163+ status: DONE
164+ summary: PASS
165+ tc_cleanup: echo "cleanup for test_two"
166+ tc_setup: echo "setup for test_two"
167+ timeout: 300
168+ type: userland
169+- build_cmd: null
170+ name: utah_tests
171+ passes: 1
172+ errors: 0
173+ failures: 0
174+ status: INPROGRESS
175+ tests:
176+ - build_cmd: echo "building for test_one"
177+ command: python test_one.py
178+ description: A first sample test case.
179+ name: test_one
180+ path: utah_tests/test_one
181+ status: DONE
182+ summary: PASS
183+ tc_cleanup: echo "cleanup for test_one"
184+ tc_setup: echo "setup for test_one"
185+ timeout: 3
186+ type: userland
187+ - build_cmd: echo "building for test_two"
188+ command: python test_two.py
189+ description: A second sample test case.
190+ name: test_two
191+ path: utah_tests/test_two
192+ status: SETUP
193+ summary: PASS
194+ tc_cleanup: echo "cleanup for test_two"
195+ tc_setup: echo "setup for test_two"
196+ timeout: 300
197+ type: userland
198+ timeout: 0
199+ ts_cleanup: null
200+ ts_setup: null
201+- build_cmd: null
202+ name: utah_tests_sample
203+ passes: 0
204+ errors: 0
205+ failures: 1
206+ status: DONE
207+ tests:
208+ - build_cmd: echo "building for sample_one"
209+ command: python sample.py
210+ description: A sample test case.
211+ name: sample_one
212+ path: utah_tests_sample/sample_one
213+ status: DONE
214+ summary: FAIL
215+ tc_cleanup: echo "cleanup for sample_one"
216+ tc_setup: echo "setup for sample_one"
217+ timeout: 200
218+ type: userland
219+ timeout: 0
220+ ts_cleanup: null
221+ ts_setup: null
222
223=== added file 'utah/client/examples/test_state_partial_run_all.yaml'
224--- utah/client/examples/test_state_partial_run_all.yaml 1970-01-01 00:00:00 +0000
225+++ utah/client/examples/test_state_partial_run_all.yaml 2012-12-05 15:31:21 +0000
226@@ -0,0 +1,90 @@
227+master_runlist: /var/lib/utah/master.run
228+status: RUN
229+result_class: !!python/name:utah.client.result.ResultYAML ''
230+fetched_suites:
231+- examples
232+- utah_tests
233+- utah_tests_sample
234+suites:
235+- build_cmd: null
236+ name: examples
237+ passes: 0
238+ errors: 0
239+ failures: 0
240+ status: NOTRUN
241+ tests:
242+ - build_cmd: echo "building for test_one"
243+ command: python test_one.py
244+ description: A first sample test case.
245+ name: test_one
246+ path: examples/test_one
247+ status: NOTRUN
248+ summary: PASS
249+ tc_cleanup: echo "cleanup for test_one"
250+ tc_setup: echo "setup for test_one"
251+ timeout: 3
252+ type: userland
253+ - build_cmd: echo "building for test_two"
254+ command: python test_two.py
255+ description: A second sample test case.
256+ name: test_two
257+ path: examples/test_two
258+ status: NOTRUN
259+ summary: PASS
260+ tc_cleanup: echo "cleanup for test_two"
261+ tc_setup: echo "setup for test_two"
262+ timeout: 300
263+ type: userland
264+- build_cmd: null
265+ name: utah_tests
266+ passes: 1
267+ errors: 0
268+ failures: 0
269+ status: NOTRUN
270+ tests:
271+ - build_cmd: echo "building for test_one"
272+ command: python test_one.py
273+ description: A first sample test case.
274+ name: test_one
275+ path: utah_tests/test_one
276+ status: NOTRUN
277+ summary: PASS
278+ tc_cleanup: echo "cleanup for test_one"
279+ tc_setup: echo "setup for test_one"
280+ timeout: 3
281+ type: userland
282+ - build_cmd: echo "building for test_two"
283+ command: python test_two.py
284+ description: A second sample test case.
285+ name: test_two
286+ path: utah_tests/test_two
287+ status: NOTRUN
288+ summary: PASS
289+ tc_cleanup: echo "cleanup for test_two"
290+ tc_setup: echo "setup for test_two"
291+ timeout: 300
292+ type: userland
293+ timeout: 0
294+ ts_cleanup: null
295+ ts_setup: null
296+- build_cmd: null
297+ name: utah_tests_sample
298+ passes: 0
299+ errors: 0
300+ failures: 1
301+ status: NOTRUN
302+ tests:
303+ - build_cmd: echo "building for sample_one"
304+ command: python sample.py
305+ description: A sample test case.
306+ name: sample_one
307+ path: utah_tests_sample/sample_one
308+ status: NOTRUN
309+ summary: PASS
310+ tc_cleanup: echo "cleanup for sample_one"
311+ tc_setup: echo "setup for sample_one"
312+ timeout: 200
313+ type: userland
314+ timeout: 0
315+ ts_cleanup: null
316+ ts_setup: null
317
318=== modified file 'utah/client/runner.py'
319--- utah/client/runner.py 2012-11-07 18:02:22 +0000
320+++ utah/client/runner.py 2012-12-05 15:31:21 +0000
321@@ -251,9 +251,9 @@
322 if not keep_going:
323 return self.process_results()
324
325- self.errors += suite.errors
326- self.passes += suite.passes
327- self.failures += suite.failures
328+ self.errors += suite.errors
329+ self.passes += suite.passes
330+ self.failures += suite.failures
331
332 self.status = "DONE"
333 self.save_state()
334@@ -443,14 +443,15 @@
335
336 self.fetched_suites.append(name)
337
338- # Create a TestSuite
339- s = TestSuite(name=name, runlist_file=suite_runlist,
340- includes=includes, excludes=excludes,
341- result=self.result, path=self.testsuitedir,
342- timeout=self.timeout,
343- _save_state_callback=self.save_state,
344- _reboot_callback=self.reboot)
345- self.add_suite(s)
346+ # Create a TestSuite
347+ s = TestSuite(name=name, runlist_file=suite_runlist,
348+ includes=includes, excludes=excludes,
349+ result=self.result, path=self.testsuitedir,
350+ timeout=self.timeout,
351+ _save_state_callback=self.save_state,
352+ _reboot_callback=self.reboot)
353+ self.add_suite(s)
354+
355
356 def get_next_suite(self):
357 """
358
359=== modified file 'utah/client/testcase.py'
360--- utah/client/testcase.py 2012-10-17 10:22:00 +0000
361+++ utah/client/testcase.py 2012-12-05 15:31:21 +0000
362@@ -27,6 +27,7 @@
363 """
364
365 status = 'NOTRUN'
366+ summary = 'PASS' # 'PASS', 'FAIL', of 'ERROR'
367 build_cmd = None
368 tc_setup = None
369 tc_cleanup = None
370@@ -181,8 +182,7 @@
371 """
372
373 if self.is_done():
374- self.run_status = 'PASS'
375- return self.run_status
376+ return 'PASS'
377
378 # Do not proceed if we are missing data
379 if (self.description is None
380@@ -203,7 +203,7 @@
381
382 # if the build fails don't run the test command
383 if result.status != 'PASS':
384- self.run_status = result.status
385+ self.summary = 'ERROR'
386
387 # reset status
388 result.status = 'PASS'
389@@ -213,7 +213,7 @@
390
391 # if the setup fails don't run the test command
392 if result.status != 'PASS':
393- self.run_status = result.status
394+ self.summary = 'ERROR'
395
396 # reset status
397 result.status = 'PASS'
398@@ -237,6 +237,11 @@
399 ),
400 extra_info=extra_info)
401
402+ # only if we haven't failed or errored so far do
403+ # we set the summary for the testcase.
404+ if self.summary == 'PASS':
405+ self.summary = result.status
406+
407 # Clean up whether 'command' failed or not.
408 self.cleanup(result)
409
410@@ -246,7 +251,6 @@
411 and result.status == 'PASS'):
412 need_reboot = True
413
414- self.run_status = result.status
415 result.status = 'PASS'
416
417 if self.status == 'CLEANUP':
418@@ -285,6 +289,7 @@
419 'command': self.command,
420 'timeout': self.timeout,
421 'status': self.status,
422+ 'summary': self.summary,
423 'build_cmd': self.build_cmd,
424 'tc_setup': self.tc_setup,
425 'tc_cleanup': self.tc_cleanup,
426
427=== modified file 'utah/client/tests/common.py'
428--- utah/client/tests/common.py 2012-10-10 14:44:00 +0000
429+++ utah/client/tests/common.py 2012-12-05 15:31:21 +0000
430@@ -89,3 +89,30 @@
431
432 if os.path.exists(examples_dir):
433 shutil.rmtree(examples_dir)
434+
435+def _get_partial_state_file(filename):
436+ """
437+ Read a partial state file from disk.
438+ """
439+
440+ state = None
441+
442+ with open(filename, 'r') as fp:
443+ state = fp.read()
444+
445+ return state
446+
447+partial_state_file_content = _get_partial_state_file(
448+ os.path.join(os.path.dirname(__file__), "..", "examples",
449+ "test_state_partial_inprogress.yaml")
450+)
451+
452+partial_state_file_content_run_all = _get_partial_state_file(
453+ os.path.join(os.path.dirname(__file__), "..", "examples",
454+ "test_state_partial_run_all.yaml")
455+)
456+
457+partial_state_file_content_done_all_failed = _get_partial_state_file(
458+ os.path.join(os.path.dirname(__file__), "..", "examples",
459+ "test_state_partial_all_failed.yaml")
460+)
461
462=== modified file 'utah/client/tests/test_state_agent.py'
463--- utah/client/tests/test_state_agent.py 2012-10-03 09:07:18 +0000
464+++ utah/client/tests/test_state_agent.py 2012-12-05 15:31:21 +0000
465@@ -12,60 +12,11 @@
466 setUp, # Used by nosetests
467 tearDown, # Used by nosetests
468 get_module_path,
469+ partial_state_file_content,
470+ partial_state_file_content_run_all,
471+ partial_state_file_content_done_all_failed,
472 )
473
474-partial_state_file_content = """master_runlist: /var/lib/utah/master.run
475-status: RUN
476-result_class: !!python/name:utah.client.result.ResultYAML ''
477-fetched_suites:
478-- utah_tests
479-- utah_tests_sample
480-suites:
481-- build_cmd: null
482- name: utah_tests
483- status: INPROGRESS
484- tests:
485- - build_cmd: echo "building for test_one"
486- command: python test_one.py
487- description: A first sample test case.
488- name: test_one
489- path: utah_tests/test_one
490- status: DONE
491- tc_cleanup: echo "cleanup for test_one"
492- tc_setup: echo "setup for test_one"
493- timeout: 3
494- type: userland
495- - build_cmd: echo "building for test_two"
496- command: python test_two.py
497- description: A second sample test case.
498- name: test_two
499- path: utah_tests/test_two
500- status: SETUP
501- tc_cleanup: echo "cleanup for test_two"
502- tc_setup: echo "setup for test_two"
503- timeout: 300
504- type: userland
505- timeout: 0
506- ts_cleanup: null
507- ts_setup: null
508-- build_cmd: null
509- name: utah_tests_sample
510- status: DONE
511- tests:
512- - build_cmd: echo "building for sample_one"
513- command: python sample.py
514- description: A sample test case.
515- name: sample_one
516- path: utah_tests_sample/sample_one
517- status: DONE
518- tc_cleanup: echo "cleanup for sample_one"
519- tc_setup: echo "setup for sample_one"
520- timeout: 200
521- type: userland
522- timeout: 0
523- ts_cleanup: null
524- ts_setup: null
525-"""
526
527
528 class TestStateAgentYAML(unittest.TestCase):
529@@ -83,6 +34,8 @@
530 self.runner = Runner(install_type="desktop", result_class=ResultYAML,
531 state_agent=self.state_agent)
532 self.partial_state_file_content = partial_state_file_content
533+ self.partial_state_file_content_run_all = partial_state_file_content_run_all
534+ self.partial_state_file_content_done_all_failed = partial_state_file_content_done_all_failed
535
536 def tearDown(self):
537 """
538@@ -159,14 +112,108 @@
539 shutil.copytree(test_src, test_dir)
540
541 state_agent = StateAgentYAML(state_file=self.state_file)
542- runner = Runner(install_type="desktop", state_agent=state_agent,
543- resume=True)
544- runner.load_state()
545+ runner = Runner(install_type="desktop",
546+ state_agent=state_agent,
547+ result_class=ResultYAML,
548+ resume=True)
549
550 self.assertEqual(runner.status, 'RUN')
551+ self.assertEqual(runner.count_suites(), 3)
552+ self.assertEqual(runner.count_tests(), 5)
553
554 next_test = runner.get_next_test()
555
556 self.assertEqual(next_test.name, 'test_two')
557
558 runner.run()
559+
560+ self.assertEqual(runner.passes, 4)
561+ self.assertEqual(runner.failures, 1)
562+ self.assertEqual(runner.errors, 0)
563+ self.assertEqual(runner.passes + runner.failures + runner.errors, 5)
564+
565+ def test_load_state_partial_run_all(self):
566+ """
567+ Test that a partially run state file can be resumed.
568+ """
569+ fp = open(self.state_file, 'w')
570+ fp.write(self.partial_state_file_content_run_all)
571+ fp.close()
572+
573+ # Need to set up utah_tests since we're simulating a restart
574+ test_src = os.path.join(get_module_path(), 'client',
575+ 'examples', 'utah_tests')
576+ test_dir = os.path.join(UTAH_DIR, 'testsuites',
577+ 'utah_tests', 'utah_tests')
578+ if not os.path.exists(test_dir):
579+ shutil.copytree(test_src, test_dir)
580+
581+ # Need to set up utah_tests_sample since we're simulating a restart
582+ test_src = os.path.join(get_module_path(), 'client',
583+ 'examples', 'utah_tests_sample')
584+ test_dir = os.path.join(UTAH_DIR, 'testsuites', 'utah_tests_sample',
585+ 'utah_tests_sample')
586+ if not os.path.exists(test_dir):
587+ shutil.copytree(test_src, test_dir)
588+
589+ state_agent = StateAgentYAML(state_file=self.state_file)
590+ runner = Runner(install_type="desktop",
591+ state_agent=state_agent,
592+ result_class=ResultYAML,
593+ resume=True)
594+
595+ self.assertEqual(runner.status, 'RUN')
596+ self.assertEqual(runner.count_suites(), 3)
597+ self.assertEqual(runner.count_tests(), 5)
598+
599+ next_test = runner.get_next_test()
600+
601+ self.assertEqual(next_test.name, 'test_one')
602+
603+ runner.run()
604+
605+ self.assertEqual(runner.passes, 3)
606+ self.assertEqual(runner.failures, 0)
607+ self.assertEqual(runner.errors, 2)
608+ self.assertEqual(runner.passes + runner.failures + runner.errors, 5)
609+
610+ def test_load_state_partial_done_all_failed(self):
611+ """
612+ Test that a partially run state file can be resumed.
613+ """
614+ fp = open(self.state_file, 'w')
615+ fp.write(self.partial_state_file_content_done_all_failed)
616+ fp.close()
617+
618+ # Need to set up utah_tests since we're simulating a restart
619+ test_src = os.path.join(get_module_path(), 'client',
620+ 'examples', 'utah_tests')
621+ test_dir = os.path.join(UTAH_DIR, 'testsuites',
622+ 'utah_tests', 'utah_tests')
623+ if not os.path.exists(test_dir):
624+ shutil.copytree(test_src, test_dir)
625+
626+ # Need to set up utah_tests_sample since we're simulating a restart
627+ test_src = os.path.join(get_module_path(), 'client',
628+ 'examples', 'utah_tests_sample')
629+ test_dir = os.path.join(UTAH_DIR, 'testsuites', 'utah_tests_sample',
630+ 'utah_tests_sample')
631+ if not os.path.exists(test_dir):
632+ shutil.copytree(test_src, test_dir)
633+
634+ state_agent = StateAgentYAML(state_file=self.state_file)
635+ runner = Runner(install_type="desktop",
636+ state_agent=state_agent,
637+ result_class=ResultYAML,
638+ resume=True)
639+
640+ self.assertEqual(runner.status, 'RUN')
641+ self.assertEqual(runner.count_suites(), 3)
642+ self.assertEqual(runner.count_tests(), 5)
643+
644+ runner.run()
645+
646+ self.assertEqual(runner.passes, 0)
647+ self.assertEqual(runner.failures, 5)
648+ self.assertEqual(runner.errors, 0)
649+ self.assertEqual(runner.passes + runner.failures + runner.errors, 5)
650
651=== modified file 'utah/client/testsuite.py'
652--- utah/client/testsuite.py 2012-10-22 08:15:08 +0000
653+++ utah/client/testsuite.py 2012-12-05 15:31:21 +0000
654@@ -204,6 +204,9 @@
655 Run the test cases; including any build, setup, and cleanup commands.
656 """
657
658+ # we gather this info from the testcases
659+ self.passes = self.errors = self.failures = 0
660+
661 # Return value to indicate whether processing of a Runner should
662 # continue. This is to avoid a shutdown race on reboot cases.
663 keep_going = True
664@@ -226,11 +229,11 @@
665 for test in self.tests:
666 keep_going = test.run()
667
668- if test.run_status == 'PASS':
669+ if test.summary == 'PASS':
670 self.passes += 1
671- elif test.run_status == 'FAIL':
672+ elif test.summary == 'FAIL':
673 self.failures += 1
674- elif test.run_status == 'ERROR':
675+ elif test.summary == 'ERROR':
676 self.errors += 1
677
678 if not keep_going:

Subscribers

People subscribed via source and target branches