chore: fix tests

This commit is contained in:
Günter Obiltschnig 2024-11-16 18:05:10 +01:00
parent a4159b1723
commit 6b2a8abd96
3 changed files with 16 additions and 9 deletions

View File

@ -57,7 +57,7 @@ namespace
n = ws.receiveFrame(buffer.begin(), static_cast<int>(_bufSize), flags);
if (n == 0)
break;
Poco::Thread::current()->sleep(handleDelay.totalMilliseconds());
Poco::Thread::current()->sleep(static_cast<long>(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();
}

View File

@ -303,9 +303,9 @@ void HTTPSClientSessionTest::testInterop()
std::set<std::string> 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");
}

View File

@ -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();
}