From d14582a1d92e036780166a0b5ec0494d7353cc75 Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Fri, 13 Jan 2023 16:20:42 +0100 Subject: Implemented and tested managed FCGI application start, separated out process check functions to libreichwein --- tests/test-webserver.cpp | 91 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 90 insertions(+), 1 deletion(-) (limited to 'tests/test-webserver.cpp') diff --git a/tests/test-webserver.cpp b/tests/test-webserver.cpp index bd89aab..5353c6a 100644 --- a/tests/test-webserver.cpp +++ b/tests/test-webserver.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -48,7 +49,8 @@ #include "webserver.h" #include "response.h" -#include "fastcgiprocess.h" +#include "plugins/fcgi/fastcgiprocess.h" + #include "helper.h" #include "webserverprocess.h" #include "websocketserverprocess.h" @@ -694,3 +696,90 @@ BOOST_FIXTURE_TEST_CASE(http_fcgi_ip6, Fixture) BOOST_CHECK_EQUAL(result.second, "returning data of : "); } +BOOST_FIXTURE_TEST_CASE(http_fcgi_unix_socket, Fixture) +{ + std::string webserver_config{R"CONFIG( + www-data + www-data + 10 + stats.db + ../plugins + + + localhost + localhost + [::1] + + fcgi + fcgi-socket + + + + + +
::1
+ 8080 + http + localhost +
+
+
)CONFIG"}; + WebserverProcess serverProcess{webserver_config}; + BOOST_REQUIRE(serverProcess.is_running()); + + FastCGIProcess fcgiProcess("./fcgi1", "fcgi-socket"); + BOOST_REQUIRE(fcgiProcess.is_running()); + + auto result {HTTP("/fcgi/abc")}; + BOOST_CHECK_EQUAL(result.first, fmt::format( +"HTTP/1.1 200 OK\r\n" +"Server: Reichwein.IT Webserver {}\r\n" +"Content-Type: text/plain\r\n" +"Content-Length: {}\r\n" +"\r\n" + , VERSION, result.second.size())); + BOOST_CHECK_EQUAL(result.second, "returning data of : "); +} + +BOOST_FIXTURE_TEST_CASE(http_fcgi_executable, Fixture) +{ + std::string webserver_config{R"CONFIG( + www-data + www-data + 10 + stats.db + ../plugins + + + localhost + localhost + [::1] + + fcgi + fcgi1 + + + + + +
::1
+ 8080 + http + localhost +
+
+
)CONFIG"}; + WebserverProcess serverProcess{webserver_config}; + BOOST_REQUIRE(serverProcess.is_running()); + + auto result {HTTP("/fcgi/abc")}; + BOOST_CHECK_EQUAL(result.first, fmt::format( +"HTTP/1.1 200 OK\r\n" +"Server: Reichwein.IT Webserver {}\r\n" +"Content-Type: text/plain\r\n" +"Content-Length: {}\r\n" +"\r\n" + , VERSION, result.second.size())); + BOOST_CHECK_EQUAL(result.second, "returning data of : "); +} + -- cgit v1.2.3