/* * Copyright (C) 2025-present ScyllaDB */ /* * SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.0 */ #pragma once #include #include #include #include #include #include #include namespace tests::proc { using namespace seastar; std::filesystem::path find_file_in_path(std::string_view name, const std::vector& path_preprend = {}, const std::vector& path_append = {} ); class process_fixture { class impl; std::unique_ptr _impl; process_fixture(std::unique_ptr); public: using buffer_type = temporary_buffer; using handler_result = consumption_result; using stream_handler = noncopyable_function(buffer_type)>; using line_handler = noncopyable_function(std::string_view)>; using handler_type = std::variant; process_fixture(process_fixture&&) noexcept; ~process_fixture(); static future create(const std::filesystem::path& exec , const std::vector& args , const std::vector& env = {} , handler_type stdout_handler = {} , handler_type stderr_handler = {} , bool inherit_env = true ); static line_handler create_copy_handler(std::ostream&); using wait_exited = seastar::experimental::process::wait_exited; using wait_signaled = seastar::experimental::process::wait_signaled; using wait_status = seastar::experimental::process::wait_status; future wait(); void terminate(); void kill(); input_stream cout(); input_stream cerr(); output_stream cin(); }; enum class service_parse_state { cont, success, failed }; using parse_service_callback = std::function; future> start_docker_service( std::string_view name, std::string_view image, parse_service_callback stdout_parse = {}, parse_service_callback stderr_parse = {}, const std::vector& docker_args = {}, const std::vector& image_args = {}, int service_port = 0 ); }