randomize Mock Auto device port to avoid collisions when multiple guh's are running

This commit is contained in:
Michael Zanetti 2014-07-06 22:20:51 +02:00
parent 0614e79193
commit 853a46d788
2 changed files with 3 additions and 2 deletions

View File

@ -268,7 +268,9 @@ void DevicePluginMock::startMonitoringAutoDevices()
DeviceDescriptor mockDescriptor(mockDeviceAutoClassId, "Mock Device (Auto created)");
ParamList params;
Param param("httpport", 4242);
qsrand(QDateTime::currentMSecsSinceEpoch());
int port = 4242 + (qrand() % 1000);
Param param("httpport", port);
params.append(param);
mockDescriptor.setParams(params);

View File

@ -241,7 +241,6 @@ void TestDevices::getConfiguredDevices()
QVariant response = injectAndWait("Devices.GetConfiguredDevices");
QVariantList devices = response.toMap().value("params").toMap().value("devices").toList();
qDebug() << "got devices" << devices;
QCOMPARE(devices.count(), 2); // There should be one auto created mock device and the one created in initTestcase()
}