-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsimulator_integration_test.py
More file actions
51 lines (45 loc) · 1.2 KB
/
simulator_integration_test.py
File metadata and controls
51 lines (45 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
from __future__ import print_function
import mock
import shutil
import sys
import tempfile
from nose.tools import *
from simulator import main
@mock.patch('base.SimulatorKernel.output')
def test_main(_):
with mock.patch('sys.argv', [
'./simulator.py',
'--lb', 'SQF',
]):
main()
@mock.patch('base.SimulatorKernel.output')
@raises(SystemExit)
def test_invalid_algorithm(_):
with mock.patch('sys.argv', [
'./simulator.py',
'--lb',
'non-existant',
]):
main()
@mock.patch('base.SimulatorKernel.output')
def test_autoscaler(_):
with mock.patch('sys.argv', [
'./simulator.py',
'--lb', 'SQF',
'--rc', 'mm_queueifac',
'--scenario', './scenarios/autoscaling-support.py',
]):
main()
@nottest
def test_all():
outdir = tempfile.mkdtemp()
print('Using:', outdir, file = sys.stderr)
with mock.patch('sys.argv', [
'./simulator.py',
'--ac', 'ALL',
'--rc', 'ALL',
'--scenario', './scenarios/autoscaling-support.py',
'--outdir', outdir
]):
main()
shutil.rmtree(outdir)