Project

Profile

Help

Issue #8305 ยป reproduce_publish_error.py

dalley, 02/25/2021 08:58 PM

 
from pulp_smash import config
from pulp_smash.pulp3.bindings import monitor_task
from pulp_smash.pulp3.utils import gen_repo

from pulp_file.tests.functional.utils import gen_file_client, gen_file_remote
from pulp_file.tests.functional.utils import set_up_module as setUpModule # noqa:F401

from pulpcore.client.pulp_file import (
ContentFilesApi,
PublicationsFileApi,
RepositoriesFileApi,
RepositorySyncURL,
RemotesFileApi,
)

cfg = config.get_config()
client = gen_file_client()

content_api = ContentFilesApi(client)
repo_api = RepositoriesFileApi(client)
remote_api = RemotesFileApi(client)
publications_api = PublicationsFileApi(client)


# create repository, remote
remote = remote_api.create(gen_file_remote(policy='on_demand'))
repo = repo_api.create(gen_repo())

# sync the repository
repository_sync_data = RepositorySyncURL(remote=remote.pulp_href)
sync_response = repo_api.sync(repo.pulp_href, repository_sync_data)
task = monitor_task(sync_response.task)

# delete the remote
monitor_task(remote_api.delete(remote.pulp_href).task)


# ^---- problem occurs here, now RemoteArtifacts deleted, now ContentArtifact is broken

publish_response = publications_api.create({"repository_version": task.created_resources[0]})
monitor_task(publish_response.task) # boom publish failure
    (1-1/1)