diff --git a/test/server_html_search.cpp b/test/server_html_search.cpp index 4e425da32..44d1ee383 100644 --- a/test/server_html_search.cpp +++ b/test/server_html_search.cpp @@ -507,7 +507,7 @@ const std::vector LARGE_SEARCH_RESULTS = { // // In order to be able to share the same expected output data // LARGE_SEARCH_RESULTS between multiple build platforms and test-points -// of the TaskbarlessServerTest.searchResults test-case +// of the ServerTest.searchResults test-case // // 1. Snippets are excluded from the plain-text comparison of actual and // expected HTML strings. This is done with the help of the @@ -583,7 +583,7 @@ bool isSubSnippet(std::string subSnippet, const std::string& superSnippet) #define RAYCHARLESZIMID "6f1d19d0-633f-087b-fb55-7ac324ff9baf" #define EXAMPLEZIMID "5dc0b3af-5df2-0925-f0ca-d2bf75e78af6" -TEST_F(TaskbarlessServerTest, searchResults) +TEST_F(ServerTest, searchResults) { struct TestData { @@ -1301,7 +1301,7 @@ TEST_F(TaskbarlessServerTest, searchResults) }; for ( const auto& t : testData ) { - const auto r = zfs1_->GET(t.url().c_str()); + const auto r = taskbarlessZimFileServer().GET(t.url().c_str()); EXPECT_EQ(r->status, 200); t.check(r->body); } diff --git a/test/server_testing_tools.h b/test/server_testing_tools.h index 779b220ee..d6a4a23a9 100644 --- a/test/server_testing_tools.h +++ b/test/server_testing_tools.h @@ -134,6 +134,9 @@ ZimFileServer::~ZimFileServer() class ServerTest : public ::testing::Test { +private: + std::unique_ptr taskbarlessZfs_; + protected: std::unique_ptr zfs1_; @@ -149,16 +152,16 @@ protected: zfs1_.reset(new ZimFileServer(SERVER_PORT, /*withTaskbar=*/true, ZIMFILES)); } + ZimFileServer& taskbarlessZimFileServer() + { + if ( ! taskbarlessZfs_ ) { + taskbarlessZfs_.reset(new ZimFileServer(SERVER_PORT+1, /*withTaskbar=*/false, ZIMFILES)); + } + return *taskbarlessZfs_; + } + void TearDown() override { zfs1_.reset(); + taskbarlessZfs_.reset(); } }; - -class TaskbarlessServerTest : public ServerTest -{ -protected: - void SetUp() override { - zfs1_.reset(new ZimFileServer(SERVER_PORT, /*withTaskbar=*/false, ZIMFILES)); - } -}; -