test: add test_stop_before_starting_compaction_manager

This commit is contained in:
Patryk Jędrzejczak
2026-05-22 11:08:57 +02:00
parent 6cde390e21
commit b7400d20dd
2 changed files with 24 additions and 0 deletions

View File

@@ -1297,6 +1297,10 @@ To start the scylla server proper, simply invoke as: scylla server (or just scyl
auto stop_cm = defer_verbose_shutdown("compaction_manager", [&cm] {
cm.stop().get();
});
utils::get_local_injector().inject("stop_before_starting_compaction_manager",
[] { throw std::runtime_error("injected failure before starting compaction_manager"); });
cm.invoke_on_all(&compaction::compaction_manager::start, std::ref(*cfg), only_on_shard0(&*disk_space_monitor_shard0)).get();
auto compaction_throughput_update = io_throughput_updater("compaction", dbcfg.compaction_scheduling_group, cfg->compaction_throughput_mb_per_sec);

View File

@@ -0,0 +1,20 @@
#
# Copyright (C) 2026-present ScyllaDB
#
# SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.1
#
import pytest
from test.pylib.manager_client import ManagerClient
@pytest.mark.skip_mode(mode='release', reason='error injections are not supported in release mode')
async def test_stop_before_starting_compaction_manager(manager: ManagerClient) -> None:
"""Test that Scylla doesn't crash when stopped during boot after constructing compaction manager (and thus
registering its task_manager module), but before enabling it (calling compaction_manager::enable()).
Reproducer for SCYLLADB-2106.
"""
await manager.server_add(
config={"error_injections_at_startup": ["stop_before_starting_compaction_manager"]},
expected_error="injected failure before starting compaction_manager")