55
66from pulpcore .app import settings
77
8- from pulp_python .tests .functional .constants import PYTHON_URL , PYTHON_EGG_FILENAME
8+ from pulp_python .tests .functional .constants import (
9+ PYTHON_URL ,
10+ PYTHON_EGG_FILENAME ,
11+ PYTHON_SM_PROJECT_SPECIFIER ,
12+ PYTHON_SM_PACKAGE_COUNT ,
13+ )
914from urllib .parse import urlsplit
1015
1116
@@ -144,7 +149,7 @@ def test_domain_content_replication(
144149 python_bindings ,
145150 python_file ,
146151 python_repo_factory ,
147- python_publication_factory ,
152+ python_remote_factory ,
148153 python_distribution_factory ,
149154 monitor_task ,
150155 monitor_task_group ,
@@ -154,13 +159,12 @@ def test_domain_content_replication(
154159 """Test replication feature through the usage of domains."""
155160 # Set up source domain to replicate from
156161 source_domain = domain_factory ()
157- repo = python_repo_factory (pulp_domain = source_domain .name )
162+ repo = python_repo_factory (pulp_domain = source_domain .name , autopublish = True )
158163 body = {"relative_path" : PYTHON_EGG_FILENAME , "file" : python_file , "repository" : repo .pulp_href }
159164 monitor_task (
160165 python_bindings .ContentPackagesApi .create (pulp_domain = source_domain .name , ** body ).task
161166 )
162- pub = python_publication_factory (repository = repo , pulp_domain = source_domain .name )
163- python_distribution_factory (publication = pub .pulp_href , pulp_domain = source_domain .name )
167+ python_distribution_factory (repository = repo , pulp_domain = source_domain .name )
164168
165169 # Create the replica domain
166170 replica_domain = domain_factory ()
@@ -171,6 +175,7 @@ def test_domain_content_replication(
171175 "domain" : source_domain .name ,
172176 "username" : bindings_cfg .username ,
173177 "password" : bindings_cfg .password ,
178+ "tls_validation" : False ,
174179 }
175180 upstream_pulp = gen_object_with_cleanup (
176181 pulpcore_bindings .UpstreamPulpsApi , upstream_pulp_body , pulp_domain = replica_domain .name
@@ -194,6 +199,25 @@ def test_domain_content_replication(
194199
195200 assert all (1 == x for x in counts .values ()), f"Replica had more than 1 object { counts } "
196201
202+ # Test that we can replicate from an Upstream on-demand source (syncs are on-demand by default)
203+ remote = python_remote_factory (
204+ includes = PYTHON_SM_PROJECT_SPECIFIER , pulp_domain = source_domain .name
205+ )
206+ body = {"remote" : remote .pulp_href }
207+ monitor_task (python_bindings .RepositoriesPythonApi .sync (repo .pulp_href , body ).task )
208+
209+ response = pulpcore_bindings .UpstreamPulpsApi .replicate (upstream_pulp .pulp_href )
210+ monitor_task_group (response .task_group )
211+
212+ response = python_bindings .ContentPackagesApi .list (pulp_domain = replica_domain .name )
213+ assert PYTHON_SM_PACKAGE_COUNT + 1 == response .count
214+ response = python_bindings .PublicationsPypiApi .list (pulp_domain = replica_domain .name )
215+ assert 2 == response .count
216+ add_to_cleanup (python_bindings .PublicationsPypiApi , response .results [0 ])
217+ assert 1 == python_bindings .RepositoriesPythonApi .list (pulp_domain = replica_domain .name ).count
218+ assert 1 == python_bindings .DistributionsPypiApi .list (pulp_domain = replica_domain .name ).count
219+ assert 1 == python_bindings .RemotesPythonApi .list (pulp_domain = replica_domain .name ).count
220+
197221
198222@pytest .fixture
199223def shelf_reader_cleanup ():
0 commit comments