From 6b2a8abd96fccdf1559e9944a4aca99064503a98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnter=20Obiltschnig?= Date: Sat, 16 Nov 2024 18:05:10 +0100 Subject: [PATCH] chore: fix tests --- NetSSL_OpenSSL/testsuite/src/WebSocketTest.cpp | 14 +++++++++----- .../testsuite/src/HTTPSClientSessionTest.cpp | 7 +++---- NetSSL_Win/testsuite/src/WebSocketTest.cpp | 4 ++++ 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/NetSSL_OpenSSL/testsuite/src/WebSocketTest.cpp b/NetSSL_OpenSSL/testsuite/src/WebSocketTest.cpp index 1d7739672..1ba81c2e6 100644 --- a/NetSSL_OpenSSL/testsuite/src/WebSocketTest.cpp +++ b/NetSSL_OpenSSL/testsuite/src/WebSocketTest.cpp @@ -57,7 +57,7 @@ namespace n = ws.receiveFrame(buffer.begin(), static_cast(_bufSize), flags); if (n == 0) break; - Poco::Thread::current()->sleep(handleDelay.totalMilliseconds()); + Poco::Thread::current()->sleep(static_cast(handleDelay.totalMilliseconds())); ws.sendFrame(buffer.begin(), n, flags); } while ((flags & WebSocket::FRAME_OP_BITMASK) != WebSocket::FRAME_OP_CLOSE); @@ -148,7 +148,7 @@ void WebSocketTest::testWebSocketTimeout() failmsg("Data exchange shall time out."); } - catch (const Poco::TimeoutException& te) + catch (const Poco::TimeoutException&) { assertTrue(sendStart.elapsed() < Poco::Timespan(4, 0).totalMicroseconds()); } @@ -222,7 +222,8 @@ void WebSocketTest::testWebSocket() assertTrue (n == 2); assertTrue ((flags & WebSocket::FRAME_OP_BITMASK) == WebSocket::FRAME_OP_CLOSE); - server.stopAll(true); + ws.close(); + server.stop(); } @@ -258,7 +259,9 @@ void WebSocketTest::testWebSocketLarge() assertTrue (n == payload.size()); assertTrue (payload.compare(0, payload.size(), buffer, 0, n) == 0); - server.stopAll(true); + ws.shutdown(); + ws.close(); + server.stop(); } @@ -325,7 +328,8 @@ void WebSocketTest::testWebSocketNB() assertTrue (n == 2); assertTrue ((flags & WebSocket::FRAME_OP_BITMASK) == WebSocket::FRAME_OP_CLOSE); - server.stopAll(true); + ws.close(); + server.stop(); } diff --git a/NetSSL_Win/testsuite/src/HTTPSClientSessionTest.cpp b/NetSSL_Win/testsuite/src/HTTPSClientSessionTest.cpp index 8c3b2ccac..4970a4a6d 100644 --- a/NetSSL_Win/testsuite/src/HTTPSClientSessionTest.cpp +++ b/NetSSL_Win/testsuite/src/HTTPSClientSessionTest.cpp @@ -303,9 +303,9 @@ void HTTPSClientSessionTest::testInterop() std::set domainNames; cert.extractNames(commonName, domainNames); - assertTrue (commonName == "secure.appinf.com" || commonName == "*.appinf.com"); - assertTrue (domainNames.find("appinf.com") != domainNames.end() - || domainNames.find("*.appinf.com") != domainNames.end()); + assertTrue (commonName.find(".appinf.com") != std::string::npos); + assertTrue (domainNames.find("secure.appinf.com") != domainNames.end() + || domainNames.find("download.appinf.com") != domainNames.end()); } @@ -326,7 +326,6 @@ void HTTPSClientSessionTest::testProxy() StreamCopier::copyStream(rs, ostr); std::string str(ostr.str()); assertTrue (str == "This is a test file for NetSSL.\n"); - assertTrue (cert.commonName() == "secure.appinf.com" || cert.commonName() == "*.appinf.com"); } diff --git a/NetSSL_Win/testsuite/src/WebSocketTest.cpp b/NetSSL_Win/testsuite/src/WebSocketTest.cpp index 21fedf777..8906ed41f 100644 --- a/NetSSL_Win/testsuite/src/WebSocketTest.cpp +++ b/NetSSL_Win/testsuite/src/WebSocketTest.cpp @@ -207,6 +207,10 @@ void WebSocketTest::testWebSocketLarge() assertTrue (n == payload.size()); assertTrue (payload.compare(0, payload.size(), buffer, 0, n) == 0); + + ws.shutdown(); + ws.close(); + server.stop(); }