@@ -243,7 +243,7 @@ def test_invokes_hook_no_java_home(self):
243
243
class PluginInstallerTests (TestCase ):
244
244
@mock .patch ("osbenchmark.utils.process.run_subprocess_with_logging" )
245
245
def test_install_plugin_successfully (self , installer_subprocess ):
246
- installer_subprocess .return_value = 0
246
+ installer_subprocess .return_value = "output" , 0
247
247
248
248
plugin = provision_config .PluginDescriptor (name = "unit-test-plugin" , config = "default" , variables = {"active" : True })
249
249
installer = provisioner .PluginInstaller (plugin ,
@@ -254,11 +254,11 @@ def test_install_plugin_successfully(self, installer_subprocess):
254
254
255
255
installer_subprocess .assert_called_with (
256
256
'/opt/opensearch/bin/opensearch-plugin install --batch "unit-test-plugin"' ,
257
- env = {"JAVA_HOME" : "/usr/local/javas/java8" })
257
+ env = {"JAVA_HOME" : "/usr/local/javas/java8" }, capture_output = True )
258
258
259
259
@mock .patch ("osbenchmark.utils.process.run_subprocess_with_logging" )
260
260
def test_install_plugin_with_bundled_jdk (self , installer_subprocess ):
261
- installer_subprocess .return_value = 0
261
+ installer_subprocess .return_value = "output" , 0
262
262
263
263
plugin = provision_config .PluginDescriptor (name = "unit-test-plugin" , config = "default" , variables = {"active" : True })
264
264
installer = provisioner .PluginInstaller (plugin ,
@@ -270,12 +270,12 @@ def test_install_plugin_with_bundled_jdk(self, installer_subprocess):
270
270
271
271
installer_subprocess .assert_called_with (
272
272
'/opt/opensearch/bin/opensearch-plugin install --batch "unit-test-plugin"' ,
273
- env = {})
273
+ env = {}, capture_output = True )
274
274
275
275
@mock .patch ("osbenchmark.utils.process.run_subprocess_with_logging" )
276
276
def test_install_unknown_plugin (self , installer_subprocess ):
277
277
# unknown plugin
278
- installer_subprocess .return_value = 64
278
+ installer_subprocess .return_value = "output" , 64
279
279
280
280
plugin = provision_config .PluginDescriptor (name = "unknown" )
281
281
installer = provisioner .PluginInstaller (plugin ,
@@ -288,12 +288,12 @@ def test_install_unknown_plugin(self, installer_subprocess):
288
288
289
289
installer_subprocess .assert_called_with (
290
290
'/opt/opensearch/bin/opensearch-plugin install --batch "unknown"' ,
291
- env = {"JAVA_HOME" : "/usr/local/javas/java8" })
291
+ env = {"JAVA_HOME" : "/usr/local/javas/java8" }, capture_output = True )
292
292
293
293
@mock .patch ("osbenchmark.utils.process.run_subprocess_with_logging" )
294
294
def test_install_plugin_with_io_error (self , installer_subprocess ):
295
295
# I/O error
296
- installer_subprocess .return_value = 74
296
+ installer_subprocess .return_value = "output" , 74
297
297
298
298
plugin = provision_config .PluginDescriptor (name = "simple" )
299
299
installer = provisioner .PluginInstaller (plugin ,
@@ -306,12 +306,12 @@ def test_install_plugin_with_io_error(self, installer_subprocess):
306
306
307
307
installer_subprocess .assert_called_with (
308
308
'/opt/opensearch/bin/opensearch-plugin install --batch "simple"' ,
309
- env = {"JAVA_HOME" : "/usr/local/javas/java8" })
309
+ env = {"JAVA_HOME" : "/usr/local/javas/java8" }, capture_output = True )
310
310
311
311
@mock .patch ("osbenchmark.utils.process.run_subprocess_with_logging" )
312
312
def test_install_plugin_with_unknown_error (self , installer_subprocess ):
313
313
# some other error
314
- installer_subprocess .return_value = 12987
314
+ installer_subprocess .return_value = "output" , 12987
315
315
316
316
plugin = provision_config .PluginDescriptor (name = "simple" )
317
317
installer = provisioner .PluginInstaller (plugin ,
@@ -320,12 +320,12 @@ def test_install_plugin_with_unknown_error(self, installer_subprocess):
320
320
321
321
with self .assertRaises (exceptions .BenchmarkError ) as ctx :
322
322
installer .install (os_home_path = "/opt/opensearch" )
323
- self .assertEqual ("Unknown error while trying to install [simple] (installer return code [12987]). Please check the logs." ,
323
+ self .assertEqual ("Unknown error 'output' while trying to install [simple] (installer return code [12987]). Please check the logs." ,
324
324
ctx .exception .args [0 ])
325
325
326
326
installer_subprocess .assert_called_with (
327
327
'/opt/opensearch/bin/opensearch-plugin install --batch "simple"' ,
328
- env = {"JAVA_HOME" : "/usr/local/javas/java8" })
328
+ env = {"JAVA_HOME" : "/usr/local/javas/java8" }, capture_output = True )
329
329
330
330
def test_pass_plugin_properties (self ):
331
331
plugin = provision_config .PluginDescriptor (name = "unit-test-plugin" ,
0 commit comments