From e164bd226aeb7ad92aab38d918aed8f52185d279 Mon Sep 17 00:00:00 2001 From: Deborah Kaplan Date: Fri, 12 Jul 2024 15:56:52 +0000 Subject: [PATCH 1/3] feat: removing the job runners in advance of removing the code @justinhynes pointed out that the task queues might be populated with the to-be-removed task during a blue-green deployment, and it makes sense to remove the job that queues up the tasks slated for removal _before_ removing the code for those tasks. FIXES: APER-3535 --- openedx/core/djangoapps/programs/signals.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/openedx/core/djangoapps/programs/signals.py b/openedx/core/djangoapps/programs/signals.py index 89292f565b66..097aac26833c 100644 --- a/openedx/core/djangoapps/programs/signals.py +++ b/openedx/core/djangoapps/programs/signals.py @@ -137,8 +137,6 @@ def handle_course_cert_date_change(sender, course_key, **kwargs): # pylint: dis LOGGER.info(f"Handling COURSE_CERT_DATE_CHANGE for course {course_key}") # import here, because signal is registered at startup, but items in tasks are not yet loaded from openedx.core.djangoapps.programs.tasks import update_certificate_available_date_on_course_update - from openedx.core.djangoapps.programs.tasks import update_certificate_visible_date_on_course_update - update_certificate_visible_date_on_course_update.delay(str(course_key)) update_certificate_available_date_on_course_update.delay(str(course_key)) @@ -163,6 +161,4 @@ def handle_course_pacing_change(sender, updated_course_overview, **kwargs): # p LOGGER.info(f"Handling COURSE_PACING_CHANGED for course {course_id}") # import here, because signal is registered at startup, but items in tasks are not yet loaded from openedx.core.djangoapps.programs.tasks import update_certificate_available_date_on_course_update - from openedx.core.djangoapps.programs.tasks import update_certificate_visible_date_on_course_update update_certificate_available_date_on_course_update.delay(course_id) - update_certificate_visible_date_on_course_update.delay(course_id) From e3ee9a9b656b78be6ac16c76efd015fd4dea3972 Mon Sep 17 00:00:00 2001 From: Deborah Kaplan Date: Fri, 12 Jul 2024 16:29:56 +0000 Subject: [PATCH 2/3] feat: updating tests to match the task should never be called now FIXES: APER-3535 --- openedx/core/djangoapps/programs/tests/test_signals.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openedx/core/djangoapps/programs/tests/test_signals.py b/openedx/core/djangoapps/programs/tests/test_signals.py index afb128a5069c..02461fc8cda4 100644 --- a/openedx/core/djangoapps/programs/tests/test_signals.py +++ b/openedx/core/djangoapps/programs/tests/test_signals.py @@ -294,7 +294,7 @@ def test_programs_enabled(self, mock_is_learner_issuance_enabled, mock_visible_d handle_course_cert_date_change(**self.signal_kwargs) assert mock_is_learner_issuance_enabled.call_count == 1 - assert mock_visible_date_task.call_count == 1 + assert mock_visible_date_task.call_count == 0 assert mock_cad_task.call_count == 1 @@ -355,5 +355,5 @@ def test_handle_course_pacing_change_credentials_enabled( handle_course_pacing_change(**self.signal_kwargs) assert mock_is_creds_enabled.call_count == 1 - assert mock_visible_date_task.call_count == 1 + assert mock_visible_date_task.call_count == 0 assert mock_cad_task.call_count == 1 From c1c4b835bf0718ad8a0299f58543dac33e6153e5 Mon Sep 17 00:00:00 2001 From: Deborah Kaplan Date: Fri, 12 Jul 2024 17:07:49 +0000 Subject: [PATCH 3/3] feat: fixed a mock import order 2 mocks were brought in an opposite order, but until this change, they always had the same result so nobody had noticed. FIXES: APER-3535 --- openedx/core/djangoapps/programs/tests/test_signals.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openedx/core/djangoapps/programs/tests/test_signals.py b/openedx/core/djangoapps/programs/tests/test_signals.py index 02461fc8cda4..5d104af2af22 100644 --- a/openedx/core/djangoapps/programs/tests/test_signals.py +++ b/openedx/core/djangoapps/programs/tests/test_signals.py @@ -238,8 +238,8 @@ def test_programs_enabled(self, mock_is_learner_issuance_enabled, mock_task): @skip_unless_lms -@mock.patch('openedx.core.djangoapps.programs.tasks.update_certificate_visible_date_on_course_update.delay') @mock.patch('openedx.core.djangoapps.programs.tasks.update_certificate_available_date_on_course_update.delay') +@mock.patch('openedx.core.djangoapps.programs.tasks.update_certificate_visible_date_on_course_update.delay') @mock.patch( 'openedx.core.djangoapps.credentials.models.CredentialsApiConfig.is_learner_issuance_enabled', new_callable=mock.PropertyMock,