69
69
returncode = go_test_package(
70
70
'github.com/juju/juju', 'go', gopath)
71
71
self.assertEqual(0, returncode)
72
self.assertEqual(run_mock.call_count, 2)
72
self.assertEqual(run_mock.call_count, 3)
73
73
args, kwargs = run_mock.call_args_list[0]
74
self.assertEqual((['go', 'test', './...'],), args)
74
self.assertEqual((['go', 'test', '-i', './...'],), args)
75
args, kwargs = run_mock.call_args_list[1]
77
(['go', 'test', '-timeout=1200s', './...'],), args)
75
78
self.assertEqual('amd64', kwargs['env'].get('GOARCH'))
76
79
self.assertEqual(gopath, kwargs['env'].get('GOPATH'))
77
80
run_mock.assert_called_with(['sudo', 'killall', '-SIGABRT', 'mongod'])
91
94
returncode = go_test_package(
92
95
'github.com/juju/juju', 'go', gopath)
93
96
self.assertEqual(0, returncode)
97
self.assertEqual(run_mock.call_count, 3)
94
98
args, kwargs = run_mock.call_args_list[0]
95
self.assertEqual(run_mock.call_count, 2)
97
(['powershell.exe', '-Command', 'go', 'test', './...'], ),
100
(['powershell.exe', '-Command', 'go', 'test', '-i', './...'], ),
102
args, kwargs = run_mock.call_args_list[1]
104
(['powershell.exe', '-Command', 'go', 'test',
105
'-timeout=1200s', './...'], ),
99
107
self.assertEqual(r'C:\foo;C:\baz', kwargs['env'].get('Path'))
100
108
self.assertEqual(None, kwargs['env'].get('PATH'))
104
112
run_mock.assert_called_with(
105
113
['taskkill.exe', '/F', '/FI', 'imagename eq mongod.exe'])
115
def test_go_test_package_compile_failure(self):
116
with temp_dir() as gopath:
117
package_path = os.path.join(
118
gopath, 'src', 'github.com', 'juju', 'juju')
119
os.makedirs(package_path)
120
with patch('gotesttarfile.run', return_value=1,
121
autospec=True) as run_mock:
122
devnull = open(os.devnull, 'w')
123
with patch('sys.stdout', devnull):
124
returncode = go_test_package(
125
'github.com/juju/juju', 'go', gopath)
126
self.assertEqual(1, returncode)
127
self.assertEqual(run_mock.call_count, 1)
128
args, kwargs = run_mock.call_args_list[0]
129
self.assertEqual((['go', 'test', '-i', './...'],), args)
107
131
def test_parse_args(self):
108
132
args = parse_args(
109
133
['-v', '-g', 'go', '-p' 'github/foo', '-r', 'juju.tar.gz'])