Ejemplo n.º 1
0
    def test_terminate_obsolete_appservers(self, mock_terminate_appservers):
        """
        Test that `terminate_obsolete_appservers_all_instances`
        calls `terminate_obsolete_appservers` on all existing instances.
        """
        for dummy in range(5):
            OpenEdXInstanceFactory()

        tasks.terminate_obsolete_appservers_all_instances()

        self.assertEqual(mock_terminate_appservers.call_count, 5)
Ejemplo n.º 2
0
    def test_terminate_obsolete_appservers(self, mock_terminate_appservers, mock_logger, mock_consul):
        """
        Test that `terminate_obsolete_appservers_all_instances`
        calls `terminate_obsolete_appservers` on all existing instances.
        """
        mock_logger.side_effect = self.mock_logger_process

        for dummy in range(5):
            OpenEdXInstanceFactory()

        tasks.terminate_obsolete_appservers_all_instances()

        self.assertEqual(mock_terminate_appservers.call_count, 5)
        self.assertEqual(mock_logger.call_count, 5)
        mock_logger.assert_called_with("Terminating obsolete appservers for instance", {})