Commit 3986ff22 authored by David Faure's avatar David Faure
Browse files

KDAV: use a different port in each test

Summary: ctest -j4 works now

Reviewers: vkrause

Reviewed By: vkrause

Differential Revision: https://phabricator.kde.org/D28569
parent e8a66e1e
...@@ -23,7 +23,7 @@ void DavCollectionsMultiFetchJobTest::initTestCase() ...@@ -23,7 +23,7 @@ void DavCollectionsMultiFetchJobTest::initTestCase()
void DavCollectionsMultiFetchJobTest::runSuccessfullTest() void DavCollectionsMultiFetchJobTest::runSuccessfullTest()
{ {
FakeServer fakeServer; FakeServer fakeServer(5990);
QUrl url(QStringLiteral("http://localhost/caldav")); QUrl url(QStringLiteral("http://localhost/caldav"));
url.setPort(fakeServer.port()); url.setPort(fakeServer.port());
KDAV::DavUrl davUrl1(url, KDAV::CalDav); KDAV::DavUrl davUrl1(url, KDAV::CalDav);
......
...@@ -21,7 +21,7 @@ void DavItemFetchJobTest::initTestCase() ...@@ -21,7 +21,7 @@ void DavItemFetchJobTest::initTestCase()
void DavItemFetchJobTest::runSuccessfullTest() void DavItemFetchJobTest::runSuccessfullTest()
{ {
FakeServer fakeServer; FakeServer fakeServer(5989);
QUrl url(QStringLiteral("http://localhost/item")); QUrl url(QStringLiteral("http://localhost/item"));
url.setPort(fakeServer.port()); url.setPort(fakeServer.port());
KDAV::DavUrl davUrl(url, KDAV::CardDav); KDAV::DavUrl davUrl(url, KDAV::CardDav);
......
...@@ -16,9 +16,9 @@ ...@@ -16,9 +16,9 @@
#include <QFile> #include <QFile>
#include <QTest> #include <QTest>
FakeServer::FakeServer(QObject *parent) FakeServer::FakeServer(int port, QObject *parent)
: QThread(parent) : QThread(parent)
, m_port(5989) , m_port(port)
{ {
moveToThread(this); moveToThread(this);
} }
......
...@@ -81,7 +81,10 @@ class FakeServer : public QThread ...@@ -81,7 +81,10 @@ class FakeServer : public QThread
Q_OBJECT Q_OBJECT
public: public:
FakeServer(QObject *parent = nullptr); /**
* Each unittest should use a different port so that they can be run in parallel
*/
FakeServer(int port = 5989, QObject *parent = nullptr);
~FakeServer(); ~FakeServer();
/** /**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment