import json import logging import unittest import pytest from retrying import retry from tests.cook import util, reasons @pytest.mark.multi_user @unittest.skipUnless(util.multi_user_tests_enabled(), 'Requires using multi-user coniguration ' '(e.g., BasicAuth) for Cook Scheduler') @pytest.mark.timeout(util.DEFAULT_TEST_TIMEOUT_SECS) # individual test timeout class PoolsCookTest(util.CookTest): @classmethod def setUpClass(cls): cls.cook_url = util.retrieve_cook_url() util.init_cook_session(cls.cook_url) def setUp(self): self.cook_url = type(self).cook_url self.logger = logging.getLogger(__name__) self.user_factory = util.UserFactory(self) @unittest.skipUnless(util.are_pools_enabled(), 'Pools are not enabled on the cluster') @pytest.mark.xfail def test_pool_scheduling(self): admin = self.user_factory.admin()
import logging import unittest import pytest from tests.cook import util @pytest.mark.multi_user @unittest.skipUnless(util.multi_user_tests_enabled(), 'Requires using multi-user coniguration (e.g., BasicAuth) for ' 'Cook Scheduler') @pytest.mark.timeout(util.DEFAULT_TEST_TIMEOUT_SECS) # individual test timeout class ImpersonationCookTest(util.CookTest): @classmethod def setUpClass(cls): cls.cook_url = util.retrieve_cook_url() util.init_cook_session(cls.cook_url) def setUp(self): self.cook_url = type(self).cook_url self.logger = logging.getLogger(__name__) self.user_factory = util.UserFactory(self) self.admin = self.user_factory.admin() self.poser = self.user_factory.impersonator() def test_impersonated_job_delete(self): user1, user2 = self.user_factory.new_users(2) with user1: job_uuid, resp = util.submit_job(self.cook_url, command='sleep 60') self.assertEqual(resp.status_code, 201, resp.text)
import logging import unittest import pytest from tests.cook import util @pytest.mark.multi_user @unittest.skipUnless( util.multi_user_tests_enabled(), 'Requires using multi-user coniguration (e.g., BasicAuth) for ' 'Cook Scheduler') @pytest.mark.timeout(util.DEFAULT_TEST_TIMEOUT_SECS) # individual test timeout class ImpersonationCookTest(util.CookTest): @classmethod def setUpClass(cls): cls.cook_url = util.retrieve_cook_url() util.init_cook_session(cls.cook_url) def setUp(self): self.cook_url = type(self).cook_url self.logger = logging.getLogger(__name__) self.user_factory = util.UserFactory(self) self.admin = self.user_factory.admin() self.poser = self.user_factory.impersonator() def test_impersonated_job_delete(self): user1, user2 = self.user_factory.new_users(2) with user1: job_uuid, resp = util.submit_job(self.cook_url, command='sleep 60')