3939
4040
4141@pytest .fixture (scope = 'class' )
42- def config_export_import_settings (module_target_sat ):
43- """Check settings and set download policy for export. Reset to original state after import"""
44- download_policy_value = module_target_sat .cli .Settings .info (
45- {'name' : 'default_download_policy' }
46- )['value' ]
47- rh_download_policy_value = module_target_sat .cli .Settings .info (
48- {'name' : 'default_redhat_download_policy' }
49- )['value' ]
50- subs_conn_enabled_value = module_target_sat .cli .Settings .info (
51- {'name' : 'subscription_connection_enabled' }
52- )['value' ]
53- module_target_sat .cli .Settings .set (
54- {'name' : 'default_redhat_download_policy' , 'value' : 'immediate' }
55- )
42+ def class_immediate_rh_download_policy (class_target_sat ):
43+ """Set RH default download policy to immediate for export. Reset to original after."""
44+ original = class_target_sat .update_setting ('default_redhat_download_policy' , 'immediate' )
5645 yield
57- module_target_sat .cli .Settings .set (
58- {'name' : 'default_download_policy' , 'value' : download_policy_value }
59- )
60- module_target_sat .cli .Settings .set (
61- {'name' : 'default_redhat_download_policy' , 'value' : rh_download_policy_value }
62- )
63- module_target_sat .cli .Settings .set (
64- {'name' : 'subscription_connection_enabled' , 'value' : subs_conn_enabled_value }
65- )
46+ class_target_sat .update_setting ('default_redhat_download_policy' , original )
6647
6748
6849@pytest .fixture
69- def export_import_cleanup_function (target_sat , function_org ):
70- """Deletes export/import dirs of function org"""
71- yield
72- target_sat .execute (
73- f'rm -rf { PULP_EXPORT_DIR } /{ function_org .name } { PULP_IMPORT_DIR } /{ function_org .name } '
74- )
75-
76-
77- @pytest .fixture # perform the cleanup after each testcase of a module
78- def export_import_cleanup_module (target_sat , module_org ):
79- """Deletes export/import dirs of module_org"""
50+ def complete_export_cleanup (target_sat ):
51+ """Deletes all org export dirs after each test."""
8052 yield
81- target_sat .execute (
82- f'rm -rf { PULP_EXPORT_DIR } /{ module_org .name } { PULP_IMPORT_DIR } /{ module_org .name } '
83- )
53+ target_sat .execute (f'rm -rf { PULP_EXPORT_DIR } *' )
8454
8555
8656@pytest .fixture
@@ -320,11 +290,12 @@ def complete_export_import_cleanup(target_sat, module_import_sat):
320290
321291
322292@pytest .mark .run_in_one_thread
293+ @pytest .mark .usefixtures ('complete_export_cleanup' )
323294class TestExport :
324295 """Tests for content export via CLI"""
325296
326297 def test_positive_export_version_custom_repo (
327- self , target_sat , export_import_cleanup_module , module_org , module_synced_custom_repo
298+ self , target_sat , module_org , module_synced_custom_repo
328299 ):
329300 """Export custom repo via complete and incremental CV version export.
330301
@@ -383,7 +354,6 @@ def test_positive_export_version_custom_repo(
383354 def test_positive_export_library_custom_repo (
384355 self ,
385356 target_sat ,
386- export_import_cleanup_function ,
387357 function_org ,
388358 function_synced_custom_repo ,
389359 function_exporter_user ,
@@ -445,7 +415,6 @@ def test_positive_export_library_custom_repo(
445415 def test_positive_export_complete_library_rh_repo (
446416 self ,
447417 target_sat ,
448- export_import_cleanup_function ,
449418 function_sca_manifest_org ,
450419 function_synced_rh_repo ,
451420 ):
@@ -490,7 +459,7 @@ def test_positive_export_complete_library_rh_repo(
490459
491460 @pytest .mark .upgrade
492461 def test_positive_export_repository_docker (
493- self , target_sat , export_import_cleanup_function , function_org , function_synced_docker_repo
462+ self , target_sat , function_org , function_synced_docker_repo
494463 ):
495464 """Export docker repo via complete and incremental repository.
496465
@@ -524,7 +493,7 @@ def test_positive_export_repository_docker(
524493
525494 @pytest .mark .upgrade
526495 def test_positive_export_version_docker (
527- self , target_sat , export_import_cleanup_function , function_org , function_synced_docker_repo
496+ self , target_sat , function_org , function_synced_docker_repo
528497 ):
529498 """Export CV with docker repo via complete and incremental version.
530499
@@ -593,7 +562,6 @@ def test_positive_export_version_docker(
593562 def test_positive_export_format_inheritance (
594563 self ,
595564 target_sat ,
596- export_import_cleanup_function ,
597565 function_org ,
598566 function_synced_custom_repo ,
599567 subject ,
@@ -686,9 +654,7 @@ def test_positive_export_format_inheritance(
686654 history = target_sat .cli .ContentExport .list ({'organization-id' : function_org .id })
687655 assert importable_msg in history [- 1 ]['path' ]
688656
689- def test_positive_export_cv_with_on_demand_repo (
690- self , export_import_cleanup_module , target_sat , module_org
691- ):
657+ def test_positive_export_cv_with_on_demand_repo (self , target_sat , module_org ):
692658 """Exporting CV version skips on_demand repo
693659
694660 :id: c366ace5-1fde-4ae7-9e84-afe58c06c0ca
@@ -779,7 +745,6 @@ def test_positive_export_cv_with_on_demand_repo(
779745 def test_postive_export_cv_syncable_with_permissions (
780746 self ,
781747 request ,
782- export_import_cleanup_function ,
783748 target_sat ,
784749 function_restrictive_umask ,
785750 function_org ,
@@ -847,6 +812,7 @@ def test_postive_export_cv_syncable_with_permissions(
847812 ), 'Unexpected permission for one or more exported files'
848813
849814
815+ @pytest .mark .usefixtures ('class_immediate_rh_download_policy' , 'complete_export_import_cleanup' )
850816class TestExportImport :
851817 """Implements content export and import tests in CLI"""
852818
@@ -855,8 +821,6 @@ def test_positive_export_import_cv_end_to_end(
855821 self ,
856822 target_sat ,
857823 module_synced_custom_repo ,
858- config_export_import_settings ,
859- export_import_cleanup_module ,
860824 module_org ,
861825 function_import_org ,
862826 ):
@@ -951,8 +915,6 @@ def test_positive_export_import_cv_end_to_end(
951915 def test_positive_export_import_default_org_view (
952916 self ,
953917 target_sat ,
954- complete_export_import_cleanup ,
955- config_export_import_settings ,
956918 function_sca_manifest_org ,
957919 function_synced_custom_repo ,
958920 function_synced_rh_repo ,
@@ -1043,8 +1005,6 @@ def test_positive_export_import_default_org_view(
10431005 def test_positive_export_import_filtered_cvv (
10441006 self ,
10451007 module_synced_custom_repo ,
1046- complete_export_import_cleanup ,
1047- config_export_import_settings ,
10481008 target_sat ,
10491009 module_org ,
10501010 module_import_sat ,
@@ -1131,8 +1091,6 @@ def test_positive_export_import_promoted_cv(
11311091 self ,
11321092 target_sat ,
11331093 module_synced_custom_repo ,
1134- export_import_cleanup_module ,
1135- config_export_import_settings ,
11361094 module_org ,
11371095 function_import_org ,
11381096 ):
@@ -1215,8 +1173,6 @@ def test_positive_export_import_promoted_cv(
12151173 def test_positive_export_import_redhat_cv (
12161174 self ,
12171175 target_sat ,
1218- complete_export_import_cleanup ,
1219- config_export_import_settings ,
12201176 function_sca_manifest_org ,
12211177 function_synced_rh_repo ,
12221178 module_import_sat ,
@@ -1307,8 +1263,6 @@ def test_negative_import_same_cv_twice(
13071263 self ,
13081264 target_sat ,
13091265 module_synced_custom_repo ,
1310- export_import_cleanup_module ,
1311- config_export_import_settings ,
13121266 module_org ,
13131267 function_import_org ,
13141268 ):
@@ -1397,8 +1351,6 @@ def test_negative_import_invalid_path(self, module_org, module_target_sat):
13971351 def test_negative_import_incomplete_archive (
13981352 self ,
13991353 target_sat ,
1400- config_export_import_settings ,
1401- export_import_cleanup_function ,
14021354 function_synced_rh_repo ,
14031355 function_sca_manifest_org ,
14041356 function_import_org_with_manifest ,
@@ -1487,7 +1439,6 @@ def test_negative_import_incomplete_archive(
14871439 def test_postive_export_import_cv_with_mixed_content_repos (
14881440 self ,
14891441 request ,
1490- complete_export_import_cleanup ,
14911442 target_sat ,
14921443 function_org ,
14931444 function_product ,
@@ -1749,7 +1700,6 @@ def test_postive_export_import_cv_with_mixed_content_repos(
17491700
17501701 def test_postive_export_import_cv_with_mixed_content_syncable (
17511702 self ,
1752- complete_export_import_cleanup ,
17531703 target_sat ,
17541704 function_org ,
17551705 function_synced_custom_repo ,
@@ -1868,8 +1818,6 @@ def test_postive_export_import_cv_with_mixed_content_syncable(
18681818 def test_postive_export_import_cv_with_file_content (
18691819 self ,
18701820 target_sat ,
1871- config_export_import_settings ,
1872- export_import_cleanup_function ,
18731821 function_org ,
18741822 function_synced_file_repo ,
18751823 function_import_org ,
@@ -1944,8 +1892,6 @@ def test_postive_export_import_cv_with_file_content(
19441892 def test_positive_export_rerun_failed_import (
19451893 self ,
19461894 target_sat ,
1947- config_export_import_settings ,
1948- export_import_cleanup_function ,
19491895 function_synced_rh_repo ,
19501896 function_sca_manifest_org ,
19511897 function_import_org_with_manifest ,
@@ -2046,8 +1992,6 @@ def test_positive_export_rerun_failed_import(
20461992 def test_postive_export_import_ansible_collection_repo (
20471993 self ,
20481994 target_sat ,
2049- config_export_import_settings ,
2050- complete_export_import_cleanup ,
20511995 function_org ,
20521996 module_import_sat ,
20531997 function_import_org_at_isat ,
@@ -2113,8 +2057,6 @@ def test_postive_export_import_ansible_collection_repo(
21132057 def test_postive_export_import_repo_with_GPG (
21142058 self ,
21152059 target_sat ,
2116- config_export_import_settings ,
2117- complete_export_import_cleanup ,
21182060 function_org ,
21192061 function_synced_custom_repo ,
21202062 module_import_sat ,
@@ -2182,8 +2124,6 @@ def test_postive_export_import_repo_with_GPG(
21822124 def test_postive_export_import_chunked_repo (
21832125 self ,
21842126 target_sat ,
2185- config_export_import_settings ,
2186- complete_export_import_cleanup ,
21872127 function_org ,
21882128 function_synced_custom_repo ,
21892129 module_import_sat ,
@@ -2249,8 +2189,6 @@ def test_postive_export_import_chunked_repo(
22492189 def test_negative_import_redhat_cv_without_manifest (
22502190 self ,
22512191 target_sat ,
2252- complete_export_import_cleanup ,
2253- config_export_import_settings ,
22542192 function_sca_manifest_org ,
22552193 function_synced_rh_repo ,
22562194 module_import_sat ,
@@ -2313,7 +2251,6 @@ def test_positive_import_content_for_disconnected_sat_with_existing_content(
23132251 self ,
23142252 target_sat ,
23152253 module_synced_custom_repo ,
2316- config_export_import_settings ,
23172254 module_org ,
23182255 function_import_org ,
23192256 ):
@@ -2403,8 +2340,6 @@ def test_positive_import_content_for_disconnected_sat_with_existing_content(
24032340 def test_positive_export_incremental_syncable_check_content (
24042341 self ,
24052342 target_sat ,
2406- export_import_cleanup_function ,
2407- config_export_import_settings ,
24082343 function_sca_manifest_org ,
24092344 function_synced_rh_repo ,
24102345 ):
@@ -2486,8 +2421,6 @@ def test_positive_export_incremental_syncable_check_content(
24862421 def test_postive_export_import_with_long_name (
24872422 self ,
24882423 target_sat ,
2489- config_export_import_settings ,
2490- export_import_cleanup_module ,
24912424 module_org ,
24922425 function_import_org ,
24932426 ):
@@ -2519,7 +2452,6 @@ def test_postive_export_import_with_long_name(
25192452 {
25202453 'name' : gen_string ('alpha' , 128 ),
25212454 'content-type' : 'yum' ,
2522- 'download-policy' : 'immediate' ,
25232455 'organization-id' : module_org .id ,
25242456 'product-id' : product .id ,
25252457 }
@@ -2600,7 +2532,6 @@ def test_postive_export_import_with_long_name(
26002532 def test_postive_export_import_large_cv (
26012533 self ,
26022534 request ,
2603- complete_export_import_cleanup ,
26042535 target_sat ,
26052536 function_org ,
26062537 function_synced_large_file_repo ,
@@ -2693,8 +2624,6 @@ def test_positive_reimport_repo(self):
26932624 def test_export_repo_incremental_with_history_id (
26942625 self ,
26952626 target_sat ,
2696- export_import_cleanup_function ,
2697- config_export_import_settings ,
26982627 function_sca_manifest_org ,
26992628 function_synced_rh_repo ,
27002629 ):
@@ -2763,8 +2692,6 @@ def test_export_repo_incremental_with_history_id(
27632692 def test_positive_export_import_incremental_yum_repo (
27642693 self ,
27652694 target_sat ,
2766- complete_export_import_cleanup ,
2767- config_export_import_settings ,
27682695 function_org ,
27692696 function_synced_custom_repo ,
27702697 module_import_sat ,
@@ -2856,8 +2783,6 @@ def test_positive_export_import_incremental_yum_repo(
28562783 def test_positive_export_import_mismatch_label (
28572784 self ,
28582785 target_sat ,
2859- export_import_cleanup_function ,
2860- config_export_import_settings ,
28612786 function_sca_manifest_org ,
28622787 function_import_org_with_manifest ,
28632788 function_synced_rh_repo ,
@@ -2947,8 +2872,6 @@ def test_positive_custom_cdn_with_credential(
29472872 self ,
29482873 request ,
29492874 target_sat ,
2950- export_import_cleanup_function ,
2951- config_export_import_settings ,
29522875 function_sca_manifest_org ,
29532876 function_synced_rh_repo ,
29542877 satellite_host ,
@@ -3074,8 +2997,6 @@ def test_positive_custom_cdn_with_credential(
30742997 def test_positive_export_import_consume_incremental_yum_repo (
30752998 self ,
30762999 target_sat ,
3077- complete_export_import_cleanup ,
3078- config_export_import_settings ,
30793000 function_org ,
30803001 function_synced_custom_repo ,
30813002 module_import_sat ,
@@ -3252,8 +3173,6 @@ def test_positive_export_import_consume_incremental_yum_repo(
32523173 def test_postive_export_import_podman_repo (
32533174 self ,
32543175 target_sat ,
3255- config_export_import_settings ,
3256- complete_export_import_cleanup ,
32573176 function_org ,
32583177 function_product ,
32593178 module_import_sat ,
@@ -3340,7 +3259,6 @@ def test_positive_export_import_mldsa_content(
33403259 rhel_contenthost ,
33413260 function_sca_manifest_org ,
33423261 function_import_org_at_isat_with_manifest ,
3343- complete_export_import_cleanup ,
33443262 ):
33453263 """Export and import the latest RHEL BaseOS repository with ML-DSA signed
33463264 packages, then consume content from the import Satellite and verify the
@@ -3356,8 +3274,7 @@ def test_positive_export_import_mldsa_content(
33563274 2. Latest RHEL content host.
33573275
33583276 :steps:
3359- 1. Enable the latest RHEL BaseOS repository on the export Satellite,
3360- set download policy to immediate, then sync.
3277+ 1. Enable the latest RHEL BaseOS repository on the export Satellite and sync.
33613278 2. Create a content view, add the repository, publish it.
33623279 3. Export the content view version in exportable or syncable format.
33633280 4. Transfer the export archive to the import Satellite and import it.
@@ -3397,7 +3314,6 @@ def test_positive_export_import_mldsa_content(
33973314 'product' : repo_dict ['product' ],
33983315 }
33993316 )
3400- target_sat .cli .Repository .update ({'download-policy' : 'immediate' , 'id' : repo ['id' ]})
34013317 target_sat .cli .Repository .synchronize ({'id' : repo ['id' ]}, timeout = '30m' )
34023318
34033319 cv = target_sat .cli_factory .make_content_view ({'organization-id' : eorg .id })
0 commit comments