예제 #1
0
    def setUpClass(cls):
        """Create repos, remotes, and api-clients for all tests."""
        cls.cfg = config.get_config()
        cls.client = ApiClient(configuration=cls.cfg.get_bindings_config())
        file_client = gen_file_client()
        cls.admin_info = {
            "task_api": TasksApi(cls.client),
            "file_client": file_client,
            "remote_api": RemotesFileApi(file_client),
            "repo_api": RepositoriesFileApi(file_client),
        }
        cls.admin_info["a_remote"] = cls.admin_info["remote_api"].create(
            gen_file_remote(policy="on_demand")
        )
        cls.admin_info["a_repo"] = cls.admin_info["repo_api"].create(gen_repo())
        cls.admin_info["sync_data"] = RepositorySyncURL(remote=cls.admin_info["a_remote"].pulp_href)

        cls.new_user = gen_user()
        file_client = gen_file_client()
        cls.user_info = {
            "task_api": TasksApi(cls.client),
            "file_client": file_client,
            "remote_api": RemotesFileApi(file_client),
            "repo_api": RepositoriesFileApi(file_client),
        }
        cls.user_info["a_remote"] = cls.user_info["remote_api"].create(
            gen_file_remote(policy="on_demand")
        )
        cls.user_info["a_repo"] = cls.user_info["repo_api"].create(gen_repo())
        cls.user_info["sync_data"] = RepositorySyncURL(remote=cls.user_info["a_remote"].pulp_href)
예제 #2
0
    def setUpClass(cls):
        cls.cfg = config.get_config()
        cls.client = api.Client(cls.cfg, api.json_handler)
        cls.client = ApiClient(configuration=cls.cfg.get_bindings_config(), )
        cls.cli_client = cli.Client(cls.cfg)

        cls.group_api = GroupsApi(cls.client)
예제 #3
0
    def setUpClass(cls):
        """Set up class variables."""
        cls.cid = str(uuid.uuid4())
        cls.cfg = config.get_config()
        cls.client = api.Client(cls.cfg, api.json_handler)
        cls.client = ApiClient(
            configuration=cls.cfg.get_bindings_config(),
            header_name="Correlation-ID",
            header_value=cls.cid,
        )
        cls.cli_client = cli.Client(cls.cfg)

        cls.orphan_api = OrphansApi(cls.client)
        cls.task_api = TasksApi(cls.client)
예제 #4
0
    def setUpClass(cls):
        """Create repos, remotes, and api-clients for all tests."""
        cls.cfg = config.get_config()
        cls.client = ApiClient(configuration=cls.cfg.get_bindings_config())
        cls.task_api = TasksApi(cls.client)

        cls.file_client = gen_file_client()
        cls.remote_api = RemotesFileApi(cls.file_client)
        cls.repo_api = RepositoriesFileApi(cls.file_client)

        cls.good_remote = cls.remote_api.create(gen_file_remote(policy="on_demand"))
        cls.good_repo = cls.repo_api.create(gen_repo())
        cls.good_sync_data = RepositorySyncURL(remote=cls.good_remote.pulp_href)

        cls.bad_remote = cls.remote_api.create(
            gen_file_remote(
                "https://fixtures.pulpproject.org/THEREISNOFILEREPOHERE/", policy="on_demand"
            )
        )
        cls.bad_repo = cls.repo_api.create(gen_repo())
        cls.bad_sync_data = RepositorySyncURL(remote=cls.bad_remote.pulp_href)
예제 #5
0

def set_up_module():
    """Skip tests Pulp 3 isn't under test or if pulpcore isn't installed."""
    require_pulp_3(SkipTest)
    require_pulp_plugins({"pulpcore"}, SkipTest)


skip_if = partial(selectors.skip_if, exc=SkipTest)  # pylint:disable=invalid-name
"""The ``@skip_if`` decorator, customized for unittest.

:func:`pulp_smash.selectors.skip_if` is test runner agnostic. This function is
identical, except that ``exc`` has been set to ``unittest.SkipTest``.
"""

core_client = ApiClient(configuration)
task_groups = TaskGroupsApi(core_client)


def monitor_task_group(tg_href):
    """Polls the task group tasks until the tasks are in a completed state.

    Args:
        tg_href(str): the href of the task group to monitor

    Returns:
        pulpcore.client.pulpcore.TaskGroup: the bindings TaskGroup object
    """
    tg = task_groups.read(tg_href)
    while not tg.all_tasks_dispatched or (tg.waiting + tg.running) > 0:
        sleep(2)