@@ -2019,7 +2019,7 @@ def test_command_request_id_closed_request_without_row_does_not_recreate_validat
20192019 bound_get_mock .assert_not_called ()
20202020 get_mock .assert_not_called ()
20212021
2022- def test_command_request_id_dry_run_does_not_mutate_state_or_emit_debug_output (self ) -> None :
2022+ def test_command_request_id_dry_run_does_not_mutate_state_and_emits_debug_output_and_preview (self ) -> None :
20232023 membership_request = self ._create_user_request ()
20242024 with self .captureOnCommitCallbacks (execute = True ):
20252025 record_membership_request_created (
@@ -2109,6 +2109,10 @@ def test_command_request_id_dry_run_does_not_mutate_state_or_emit_debug_output(s
21092109 f"dry-run: note preview for request ID { membership_request .pk } via --request-id" ,
21102110 output ,
21112111 )
2112+ self .assertIn (
2113+ f"dry-run: real run would write note for request ID { membership_request .pk } via --request-id" ,
2114+ output ,
2115+ )
21122116 self .assertIn ("Mirror validation summary" , output )
21132117 self .assertIn ("Domain responds: ✓ reachable" , output )
21142118 self .assertIn ("Mirror timestamp is current: ✓ up-to-date" , output )
@@ -2117,7 +2121,22 @@ def test_command_request_id_dry_run_does_not_mutate_state_or_emit_debug_output(s
21172121 "GitHub pull request is valid: ✓ valid" ,
21182122 output ,
21192123 )
2120- self .assertNotIn ("debug:" , output )
2124+ self .assertIn (
2125+ "debug: domain target=https://mirror.example.org result=reachable" ,
2126+ output ,
2127+ )
2128+ self .assertIn (
2129+ "debug: mirror targets=https://mirror.example.org/TIME, https://mirror.example.org/almalinux/TIME result=up_to_date" ,
2130+ output ,
2131+ )
2132+ self .assertIn (
2133+ "debug: AlmaLinux mirror network target=https://raw.githubusercontent.com/AlmaLinux/mirrors/refs/heads/master/mirrors.d/mirror.example.org.yml result=registered" ,
2134+ output ,
2135+ )
2136+ self .assertIn (
2137+ "debug: GitHub target=https://github.com/AlmaLinux/mirrors/pull/123 diff=https://github.com/AlmaLinux/mirrors/pull/123.diff result=valid" ,
2138+ output ,
2139+ )
21212140 self .assertGreaterEqual (bound_get_mock .call_count , 3 )
21222141 self .assertGreaterEqual (get_mock .call_count , 3 )
21232142
@@ -2131,7 +2150,7 @@ def test_command_request_id_dry_run_does_not_mutate_state_or_emit_debug_output(s
21312150 self .assertIn ("https://github.com/AlmaLinux/mirrors/pull/123" , requested_urls )
21322151 self .assertIn ("https://github.com/AlmaLinux/mirrors/pull/123.diff" , requested_urls )
21332152
2134- def test_command_request_id_dry_run_skips_note_preview_when_retryable_result_would_not_write_note (self ) -> None :
2153+ def test_command_request_id_dry_run_shows_note_preview_and_real_path_note_decision_for_retryable_result (self ) -> None :
21352154 membership_request = self ._create_user_request ()
21362155
21372156 def retryable_requests_get (url : str , ** kwargs ) -> _FakeResponse :
@@ -2158,12 +2177,27 @@ def retryable_requests_get(url: str, **kwargs) -> _FakeResponse:
21582177 f"dry-run: would validate request ID { membership_request .pk } via --request-id" ,
21592178 output ,
21602179 )
2161- self .assertNotIn ("dry-run: note preview for request ID" , output )
2162- self .assertNotIn ("Mirror validation summary" , output )
2180+ self .assertIn (
2181+ f"dry-run: note preview for request ID { membership_request .pk } via --request-id" ,
2182+ output ,
2183+ )
2184+ self .assertIn (
2185+ f"dry-run: real run would not write note for request ID { membership_request .pk } via --request-id" ,
2186+ output ,
2187+ )
2188+ self .assertIn ("Mirror validation summary" , output )
2189+ self .assertIn ("Domain responds: ✓ reachable" , output )
2190+ self .assertIn ("Mirror timestamp is current: ✓ up-to-date" , output )
2191+ self .assertIn ("AlmaLinux mirror network registration: ✓ registered" , output )
2192+ self .assertIn ("GitHub pull request is valid: ? retryable upstream failure (503)" , output )
2193+ self .assertIn (
2194+ "debug: GitHub target=https://github.com/AlmaLinux/mirrors/pull/123 result=retryable_upstream_failure" ,
2195+ output ,
2196+ )
21632197 self .assertFalse (Note .objects .filter (membership_request = membership_request , username = CUSTOS ).exists ())
21642198 self .assertFalse (MirrorMembershipValidation .objects .filter (membership_request = membership_request ).exists ())
21652199
2166- def test_command_request_id_dry_run_skips_note_preview_when_matching_note_already_exists (self ) -> None :
2200+ def test_command_request_id_dry_run_shows_note_preview_when_matching_note_already_exists (self ) -> None :
21672201 membership_request = self ._create_user_request ()
21682202 with self .captureOnCommitCallbacks (execute = True ):
21692203 record_membership_request_created (
@@ -2196,8 +2230,19 @@ def test_command_request_id_dry_run_skips_note_preview_when_matching_note_alread
21962230 f"dry-run: would validate request ID { membership_request .pk } via --request-id" ,
21972231 dry_run_output ,
21982232 )
2199- self .assertNotIn ("dry-run: note preview for request ID" , dry_run_output )
2200- self .assertNotIn ("Mirror validation summary" , dry_run_output )
2233+ self .assertIn (
2234+ f"dry-run: note preview for request ID { membership_request .pk } via --request-id" ,
2235+ dry_run_output ,
2236+ )
2237+ self .assertIn (
2238+ f"dry-run: real run would not write note for request ID { membership_request .pk } via --request-id" ,
2239+ dry_run_output ,
2240+ )
2241+ self .assertIn ("Mirror validation summary" , dry_run_output )
2242+ self .assertIn ("Domain responds: ✓ reachable" , dry_run_output )
2243+ self .assertIn ("Mirror timestamp is current: ✓ up-to-date" , dry_run_output )
2244+ self .assertIn ("AlmaLinux mirror network registration: ✓ registered" , dry_run_output )
2245+ self .assertIn ("GitHub pull request is valid: ✓ valid" , dry_run_output )
22012246 self .assertEqual (Note .objects .filter (membership_request = membership_request , username = CUSTOS ).count (), 1 )
22022247
22032248 def test_command_request_id_rejects_nonexistent_request_id (self ) -> None :
0 commit comments