Merge "Acquire NSB specific data from Heat."
[yardstick.git] / tests / unit / benchmark / runner / test_base.py
1 #!/usr/bin/env python
2
3 ##############################################################################
4 # Copyright (c) 2017 Huawei Technologies Co.,Ltd and others.
5 #
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Apache License, Version 2.0
8 # which accompanies this distribution, and is available at
9 # http://www.apache.org/licenses/LICENSE-2.0
10 ##############################################################################
11
12 from __future__ import print_function
13 from __future__ import absolute_import
14
15 import unittest
16 import multiprocessing
17 import time
18
19 from yardstick.benchmark.runners.iteration import IterationRunner
20
21
22 class RunnerTestCase(unittest.TestCase):
23
24     def test_get_output(self):
25         queue = multiprocessing.Queue()
26         runner = IterationRunner({}, queue)
27         runner.output_queue.put({'case': 'opnfv_yardstick_tc002'})
28         runner.output_queue.put({'criteria': 'PASS'})
29
30         idle_result = {
31             'case': 'opnfv_yardstick_tc002',
32             'criteria': 'PASS'
33         }
34
35         time.sleep(1)
36         actual_result = runner.get_output()
37         self.assertEqual(idle_result, actual_result)
38
39
40 def main():
41     unittest.main()
42
43
44 if __name__ == '__main__':
45     main()