Skip to content

Commit

Permalink
Remove obsoleted enablersyncdservice actor
Browse files Browse the repository at this point in the history
The `transitionsystemdservicesstates` actor now handles all such
services generically, which makes this actor obsolete.
  • Loading branch information
matejmatuska committed Oct 9, 2023
1 parent 7c0f0d1 commit fae327d
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 77 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ def _report_kept_enabled(tasks):
)
if tasks:
summary += (
"The following services were originally disabled on the upgraded system"
" and Leapp attempted to enable them:{}{}"
"The following services were originally disabled by preset on the"
" upgraded system and Leapp attempted to enable them:{}{}"
).format(FMT_LIST_SEPARATOR, FMT_LIST_SEPARATOR.join(sorted(tasks.to_enable)))
# TODO(mmatuska): When post-upgrade reports are implemented in
# `setsystemdservicesstates actor, add a note here to check the reports
Expand Down Expand Up @@ -193,9 +193,9 @@ def process():
presets_source = _expect_message(SystemdServicesPresetInfoSource).presets
presets_target = _expect_message(SystemdServicesPresetInfoTarget).presets

services_source = dict((p.name, p.state) for p in services_source)
presets_source = dict((p.service, p.state) for p in presets_source)
presets_target = dict((p.service, p.state) for p in presets_target)
services_source = {p.name: p.state for p in services_source}
presets_source = {p.service: p.state for p in presets_source}
presets_target = {p.service: p.state for p in presets_target}

services_target = _filter_services(services_source, services_target)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,17 +177,38 @@ def test_tasks_produced_reports_created(monkeypatch):
assert api.produce.model_instances[0].to_disable == expected_tasks.to_disable


def test_report_kept_enabled(monkeypatch):
@pytest.mark.parametrize(
"tasks, expect_extended_summary",
(
(
SystemdServicesTasks(
to_enable=["test.service", "other.service"],
to_disable=["another.service"],
),
True,
),
(None, False),
),
)
def test_report_kept_enabled(monkeypatch, tasks, expect_extended_summary):
created_reports = create_report_mocked()
monkeypatch.setattr(reporting, "create_report", created_reports)

tasks = SystemdServicesTasks(
to_enable=["test.service", "other.service"], to_disable=["another.service"]
)
transitionsystemdservicesstates._report_kept_enabled(tasks)

extended_summary_str = (
"The following services were originally disabled by preset on the"
" upgraded system and Leapp attempted to enable them"
)

assert created_reports.called
assert all([s in created_reports.report_fields["summary"] for s in tasks.to_enable])
if expect_extended_summary:
assert extended_summary_str in created_reports.report_fields["summary"]
assert all(
[s in created_reports.report_fields["summary"] for s in tasks.to_enable]
)
else:
assert extended_summary_str not in created_reports.report_fields["summary"]


def test_get_newly_enabled():
Expand All @@ -205,7 +226,7 @@ def test_get_newly_enabled():
newly_enabled = transitionsystemdservicesstates._get_newly_enabled(
services_source, desired_states
)
assert newly_enabled == ['test.service']
assert newly_enabled == ["test.service"]


def test_report_newly_enabled(monkeypatch):
Expand Down
21 changes: 0 additions & 21 deletions repos/system_upgrade/el7toel8/actors/enablersyncdservice/actor.py

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit fae327d

Please sign in to comment.