Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,14 @@ def handle(self, *args, **options):
raise CommandError("Meilisearch is not enabled. Please set MEILISEARCH_ENABLED to True in your settings.")

if options["reset"]:
raise CommandError(
log.warning(
"The --reset flag has been removed. "
"Index reset is now handled automatically by post_migrate reconciliation. "
"Run: ./manage.py cms migrate"
)

if options["init"]:
raise CommandError(
log.warning(
"The --init flag has been removed. "
"Index initialization is now handled automatically by post_migrate reconciliation. "
"Run: ./manage.py cms migrate"
Expand Down
16 changes: 3 additions & 13 deletions openedx/core/djangoapps/content/search/tests/test_reindex_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,25 +39,15 @@ def test_disabled(self):
with pytest.raises(CommandError, match="not enabled"):
call_command("reindex_studio")

def test_reset_flag_removed(self):
"""Passing --reset raises a clear error."""
with pytest.raises(CommandError, match="--reset flag has been removed"):
call_command("reindex_studio", "--reset")

def test_init_flag_removed(self):
"""Passing --init raises a clear error."""
with pytest.raises(CommandError, match="--init flag has been removed"):
call_command("reindex_studio", "--init")

@patch("openedx.core.djangoapps.content.search.tasks.rebuild_index_incremental.delay")
@patch("openedx.core.djangoapps.content.search.management.commands.reindex_studio.log")
def test_incremental_flag_accepted_with_warning(self, mock_log, mock_delay):
"""Passing --incremental logs a warning but still enqueues the task."""
"""Passing old flags logs a warning but still enqueues the task."""
mock_delay.return_value = Mock(id="fake-task-id")

call_command("reindex_studio", "--incremental")
call_command("reindex_studio", "--incremental", "--init", "--experimental", "--reset")

mock_log.warning.assert_called_once()
assert mock_log.warning.call_count == 4
mock_delay.assert_called_once_with()


Expand Down
Loading