コード例 #1
0
ファイル: test_server.py プロジェクト: Svjard/presto-admin
 def test_server_restart_port_in_use(self, mock_port_in_use,
                                     mock_version_check, mock_check_status,
                                     mock_sudo):
     env.host = "good_node"
     mock_version_check.return_value = ''
     mock_port_in_use.return_value = 1
     server.restart()
     mock_sudo.assert_called_with('set -m; ' + INIT_SCRIPTS + ' stop')
     mock_version_check.assert_called_with()
     self.assertEqual(False, mock_check_status.called)
コード例 #2
0
ファイル: test_server.py プロジェクト: ludun624/presto-admin
 def test_server_restart_port_in_use(self, mock_port_in_use,
                                     mock_version_check, mock_check_status,
                                     mock_sudo):
     env.host = "good_node"
     mock_version_check.return_value = ''
     mock_port_in_use.return_value = 1
     server.restart()
     mock_sudo.assert_called_with('set -m; ' + INIT_SCRIPTS + ' stop')
     mock_version_check.assert_called_with()
     self.assertEqual(False, mock_check_status.called)
コード例 #3
0
ファイル: test_server.py プロジェクト: Svjard/presto-admin
    def test_server_restart_fail(self, mock_port_in_use, mock_version_check,
                                 mock_warn, mock_status, mock_sudo):
        mock_status.return_value = False
        env.host = "failed_node1"
        mock_version_check.return_value = ''
        mock_port_in_use.return_value = 0
        server.restart()
        mock_sudo.assert_any_call('set -m; ' + INIT_SCRIPTS + ' stop')
        mock_sudo.assert_any_call('set -m; ' + INIT_SCRIPTS + ' start')
        mock_version_check.assert_called_with()

        mock_warn.assert_called_with(self.SERVER_FAIL_MSG)
コード例 #4
0
    def test_server_restart_fail(self, mock_port_in_use, mock_version_check,
                                 mock_warn, mock_status, mock_sudo):
        mock_status.return_value = False
        env.host = "failed_node1"
        mock_version_check.return_value = ''
        mock_port_in_use.return_value = 0
        server.restart()
        mock_sudo.assert_any_call('set -m; ' + INIT_SCRIPTS + ' stop')
        mock_sudo.assert_any_call('set -m; ' + INIT_SCRIPTS + ' start')
        mock_version_check.assert_called_with()

        mock_warn.assert_called_with(self.SERVER_FAIL_MSG)
コード例 #5
0
ファイル: test_server.py プロジェクト: Svjard/presto-admin
 def test_server_restart(self, mock_port_in_use, mock_version_check,
                         mock_status, mock_sudo, mock_lookup_host):
     mock_status.return_value = True
     env.host = 'good_node'
     mock_version_check.return_value = ''
     mock_port_in_use.return_value = 0
     server.restart()
     mock_sudo.assert_any_call('set -m; ' + INIT_SCRIPTS + ' stop')
     mock_sudo.assert_any_call('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())
コード例 #6
0
ファイル: test_server.py プロジェクト: ludun624/presto-admin
 def test_server_restart(self, mock_port_in_use, mock_version_check,
                         mock_status, mock_sudo, mock_lookup_host):
     mock_status.return_value = True
     env.host = 'good_node'
     mock_version_check.return_value = ''
     mock_port_in_use.return_value = 0
     server.restart()
     mock_sudo.assert_any_call('set -m; ' + INIT_SCRIPTS + ' stop')
     mock_sudo.assert_any_call('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())