Esempio n. 1
0
 def test_server_start_bad_presto_version(self, mock_port_in_use,
                                          mock_version_check, mock_sudo):
     env.host = "good_node"
     mock_version_check.return_value = 'Presto not installed'
     server.start()
     mock_version_check.assert_called_with()
     self.assertEqual(False, mock_sudo.called)
Esempio n. 2
0
 def test_server_start_port_in_use(self, mock_port_in_use,
                                   mock_version_check, mock_sudo):
     env.host = "good_node"
     mock_version_check.return_value = ''
     mock_port_in_use.return_value = 1
     server.start()
     mock_version_check.assert_called_with()
     mock_port_in_use.assert_called_with('good_node')
     self.assertEqual(False, mock_sudo.called)
Esempio n. 3
0
 def test_server_start_fail(self, mock_port_in_use,
                            mock_version_check, mock_warn,
                            mock_query_for_status, mock_sudo, mock_run, mock_config):
     mock_query_for_status.return_value = False
     env.host = "failed_node1"
     mock_version_check.return_value = ''
     mock_port_in_use.return_value = 0
     mock_config.return_value = None
     server.start()
     mock_sudo.assert_called_with('set -m; ' + INIT_SCRIPTS + ' start')
     mock_version_check.assert_called_with()
     mock_warn.assert_called_with(self.SERVER_FAIL_MSG)
Esempio n. 4
0
 def test_server_start(self, mock_port_in_use, mock_version_check,
                       mock_execute, mock_sudo):
     mock_execute.return_value = True
     env.host = 'good_node'
     mock_version_check.return_value = ''
     mock_port_in_use.return_value = 0
     server.start()
     mock_sudo.assert_called_with('set -m; ' + INIT_SCRIPTS + ' start')
     mock_version_check.assert_called_with()
     self.assertEqual('Waiting to make sure we can connect to the Presto '
                      'server on good_node, please wait. This check will '
                      'time out after 2 minutes if the server does not '
                      'respond.\nServer started successfully on: '
                      'good_node\n', self.test_stdout.getvalue())
Esempio n. 5
0
 def test_server_start_fail(self, mock_port_in_use,
                            mock_version_check, mock_warn,
                            mock_execute, mock_sudo, mock_run):
     old_retry_timeout = server.RETRY_TIMEOUT
     server.RETRY_TIMEOUT = 1
     mock_execute.return_value = False
     env.host = "failed_node1"
     mock_version_check.return_value = ''
     mock_port_in_use.return_value = 0
     server.start()
     mock_sudo.assert_called_with('set -m; ' + INIT_SCRIPTS + ' start')
     mock_version_check.assert_called_with()
     mock_warn.assert_called_with(self.SERVER_FAIL_MSG)
     server.RETRY_TIMEOUT = old_retry_timeout