Project

Profile

Help

Issue #8305 ยป reproduce_publish_error.py

dalley, 02/25/2021 08:58 PM

 
1
from pulp_smash import config
2
from pulp_smash.pulp3.bindings import monitor_task
3
from pulp_smash.pulp3.utils import gen_repo
4

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

    
8
from pulpcore.client.pulp_file import (
9
    ContentFilesApi,
10
    PublicationsFileApi,
11
    RepositoriesFileApi,
12
    RepositorySyncURL,
13
    RemotesFileApi,
14
)
15

    
16
cfg = config.get_config()
17
client = gen_file_client()
18

    
19
content_api = ContentFilesApi(client)
20
repo_api = RepositoriesFileApi(client)
21
remote_api = RemotesFileApi(client)
22
publications_api = PublicationsFileApi(client)
23

    
24

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

    
29
# sync the repository
30
repository_sync_data = RepositorySyncURL(remote=remote.pulp_href)
31
sync_response = repo_api.sync(repo.pulp_href, repository_sync_data)
32
task = monitor_task(sync_response.task)
33

    
34
# delete the remote
35
monitor_task(remote_api.delete(remote.pulp_href).task)
36

    
37

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

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