From 37b9cccc1cef5a1f5d184e97edbc4be901a08b33 Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Tue, 28 Oct 2025 19:11:24 +0300 Subject: [PATCH] test: Don't reuse on-stack input stream The test consists of several snippets, each creating an input_stream for some short operation and checking the result. Each snipped over-writes the local `input_stream in` variable with the new one. This change wraps each of those snippets into own code block in order to have own new `input_stream in` variable in each. Signed-off-by: Pavel Emelyanov --- test/boost/sstable_test.cc | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/test/boost/sstable_test.cc b/test/boost/sstable_test.cc index f9aefe0ff5..af216692a4 100644 --- a/test/boost/sstable_test.cc +++ b/test/boost/sstable_test.cc @@ -692,36 +692,48 @@ SEASTAR_TEST_CASE(test_skipping_in_compressed_stream) { BOOST_REQUIRE(b.empty()); }; + { auto in = make_is(); expect(in, buf1); expect(in, buf2); expect_eof(in); + } - in = make_is(); + { + auto in = make_is(); in.skip(0).get(); expect(in, buf1); expect(in, buf2); expect_eof(in); + } - in = make_is(); + { + auto in = make_is(); expect(in, buf1); in.skip(0).get(); expect(in, buf2); expect_eof(in); + } - in = make_is(); + { + auto in = make_is(); expect(in, buf1); in.skip(opts.buffer_size).get(); expect_eof(in); + } - in = make_is(); + { + auto in = make_is(); in.skip(opts.buffer_size * 2).get(); expect_eof(in); + } - in = make_is(); + { + auto in = make_is(); in.skip(opts.buffer_size).get(); in.skip(opts.buffer_size).get(); expect_eof(in); + } }); }