Files
scylladb/test/boost/generic_server_test.cc
Pavel Emelyanov 8b2cababb6 generic_server: Don't mess with db::config
The db::config is top-level configuration of scylla, we generally try to
avoid using it even in scylla components: each uses its own config
initialized by the service creator out of the db::config itself. The
generic_server is not an exception, all the more so, it already has its
own config.

Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>

Closes scylladb/scylladb#23705
2025-04-16 17:02:30 +03:00

40 lines
1.2 KiB
C++

/*
* Copyright (C) 2024-present ScyllaDB
*/
/*
* SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.0
*/
#include <chrono>
#include <seastar/core/lowres_clock.hh>
#include <seastar/core/with_timeout.hh>
#include <seastar/testing/test_case.hh>
#include <seastar/util/log.hh>
#include "generic_server.hh"
#include "utils/assert.hh"
using namespace generic_server;
using namespace logging;
using namespace seastar;
using namespace std::literals::chrono_literals;
static logger test_logger("test_server");
class test_server : public server {
public:
test_server(const utils::updateable_value_source<uint32_t>& c) : server("test_server", test_logger, config{utils::updateable_value<uint32_t>(c)}) {};
protected:
[[noreturn]] shared_ptr<connection> make_connection(socket_address, connected_socket&&, socket_address, named_semaphore& sem, semaphore_units<named_semaphore_exception_factory> initial_sem_units) override {
SCYLLA_ASSERT(false);
}
};
SEASTAR_TEST_CASE(stop_without_listening) {
utils::updateable_value_source<uint32_t> concurrency(1);
test_server srv(concurrency);
co_await with_timeout(lowres_clock::now() + 5min, srv.stop());
co_return;
}