Esempio n. 1
0
 def test_check_success_fail(self,  mock_sleep):
     old_retry_timeout = server.RETRY_TIMEOUT
     server.RETRY_TIMEOUT = SLEEP_INTERVAL + 1
     client_mock = MagicMock(PrestoClient)
     client_mock.execute_query.side_effect = [False, False]
     self.assertEqual(server.check_server_status(client_mock), False)
     server.RETRY_TIMEOUT = old_retry_timeout
Esempio n. 2
0
 def test_check_success_fail(self,  mock_sleep):
     old_retry_timeout = server.RETRY_TIMEOUT
     server.RETRY_TIMEOUT = SLEEP_INTERVAL + 1
     client_mock = MagicMock(PrestoClient)
     client_mock.execute_query.side_effect = [False, False]
     self.assertEqual(server.check_server_status(client_mock), False)
     server.RETRY_TIMEOUT = old_retry_timeout
Esempio n. 3
0
 def test_check_success_status(self, mock_run_sql, string_config_mock, mock_run, mock_presto_config):
     env.roledefs = {
         'coordinator': ['Node1'],
         'worker': ['Node1', 'Node2', 'Node3', 'Node4'],
         'all': ['Node1', 'Node2', 'Node3', 'Node4']
     }
     env.hosts = env.roledefs['all']
     env.host = 'Node1'
     string_config_mock.return_value = 'Node1'
     mock_run_sql.return_value = [['Node2', 'some stuff'], ['Node1', 'some other stuff']]
     self.assertEqual(server.check_server_status(), True)
Esempio n. 4
0
 def test_check_success_fail(self, mock_query_for_status, string_config_mock, mock_run):
     env.roledefs = {
         'coordinator': ['Node1'],
         'worker': ['Node1', 'Node2', 'Node3', 'Node4'],
         'all': ['Node1', 'Node2', 'Node3', 'Node4']
     }
     env.hosts = env.roledefs['all']
     env.host = 'Node1'
     string_config_mock.return_value = 'Node1'
     mock_query_for_status.return_value = False
     self.assertEqual(server.check_server_status(), False)
Esempio n. 5
0
 def test_check_success_status(self, mock_run_sql, string_config_mock, mock_run, mock_presto_config):
     env.roledefs = {
         'coordinator': ['Node1'],
         'worker': ['Node1', 'Node2', 'Node3', 'Node4'],
         'all': ['Node1', 'Node2', 'Node3', 'Node4']
     }
     env.hosts = env.roledefs['all']
     env.host = 'Node1'
     string_config_mock.return_value = 'Node1'
     mock_run_sql.return_value = [['Node2', 'some stuff'], ['Node1', 'some other stuff']]
     self.assertEqual(server.check_server_status(), True)
Esempio n. 6
0
 def test_check_success_status(self, mock_sleep):
     client_mock = MagicMock(PrestoClient)
     client_mock.execute_query.side_effect = [False, True]
     self.assertEqual(server.check_server_status(client_mock), True)
Esempio n. 7
0
 def test_check_success_status(self, mock_sleep):
     client_mock = MagicMock(PrestoClient)
     client_mock.execute_query.side_effect = [False, True]
     self.assertEqual(server.check_server_status(client_mock), True)