aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2019-06-07 16:45:47 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2019-06-11 12:02:17 +0000
commit32afe831084d09acf447f129282e371fa0c892f7 (patch)
tree7757eb6a855b2c2bd47791266f3226a1e9bb515c /tests/auto
parent4d3bb1c85859be07001a76fad24de457811a7d63 (diff)
SSH: Fix autotest
- Consider the case of connection sharing being disabled. - Adapt to slower environments. Change-Id: I088622034c26ea343eb78161b24c43b3286b0512 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/ssh/tst_ssh.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/tests/auto/ssh/tst_ssh.cpp b/tests/auto/ssh/tst_ssh.cpp
index 5ce94b7462..72260c2c9a 100644
--- a/tests/auto/ssh/tst_ssh.cpp
+++ b/tests/auto/ssh/tst_ssh.cpp
@@ -27,6 +27,7 @@
#include <ssh/sftptransfer.h>
#include <ssh/sshconnection.h>
#include <ssh/sshremoteprocessrunner.h>
+#include <ssh/sshsettings.h>
#include <utils/environment.h>
#include <utils/temporarydirectory.h>
@@ -171,8 +172,10 @@ void tst_Ssh::errorHandling()
connection.connectToHost();
loop.exec();
QVERIFY(timer.isActive());
- QCOMPARE(connection.state(), SshConnection::Unconnected);
- QVERIFY(!connection.errorString().isEmpty());
+ const bool expectConnected = !SshSettings::connectionSharingEnabled();
+ QCOMPARE(connection.state(), expectConnected ? SshConnection::Connected
+ : SshConnection::Unconnected);
+ QCOMPARE(connection.errorString().isEmpty(), expectConnected);
QVERIFY(!disconnected);
QVERIFY2(dataReceived.isEmpty(), qPrintable(dataReceived));
}
@@ -374,7 +377,7 @@ void tst_Ssh::sftp()
};
FilesToTransfer filesToUpload;
std::srand(QDateTime::currentDateTime().toSecsSinceEpoch());
- for (int i = 0; i < 1000; ++i) {
+ for (int i = 0; i < 100; ++i) {
const QString fileName = "sftptestfile" + QString::number(i + 1);
QFile file(dirForFilesToUpload.path() + '/' + fileName);
QVERIFY2(file.open(QIODevice::WriteOnly), qPrintable(file.errorString()));
@@ -413,7 +416,7 @@ void tst_Ssh::sftp()
QTimer timer;
QObject::connect(&timer, &QTimer::timeout, &loop, &QEventLoop::quit);
timer.setSingleShot(true);
- timer.setInterval((params.timeout + 5) * 1000);
+ timer.setInterval(30 * 1000);
timer.start();
upload->start();
loop.exec();
@@ -453,7 +456,7 @@ void tst_Ssh::sftp()
// Download the uploaded files to a different location
const QStringList allUploadedFileNames
= QDir(dirForFilesToUpload.path()).entryList(QDir::Files);
- QCOMPARE(allUploadedFileNames.size(), 1001);
+ QCOMPARE(allUploadedFileNames.size(), 101);
for (const QString &fileName : allUploadedFileNames) {
const QString localFilePath = dirForFilesToUpload.path() + '/' + fileName;
const QString remoteFilePath = getRemoteFilePath(fileName);
@@ -462,7 +465,7 @@ void tst_Ssh::sftp()
QVERIFY(downloadJob != SftpInvalidJob);
jobs << downloadJob;
}
- QCOMPARE(jobs.size(), 1001);
+ QCOMPARE(jobs.size(), 101);
loop.exec();
QVERIFY(!invalidFinishedSignal);
QVERIFY2(jobError.isEmpty(), qPrintable(jobError));
@@ -490,6 +493,7 @@ void tst_Ssh::sftp()
}
// Remove the uploaded files on the remote system
+ timer.setInterval((params.timeout + 5) * 1000);
for (const QString &fileName : allUploadedFileNames) {
const QString remoteFilePath = getRemoteFilePath(fileName);
const SftpJobId removeJob = sftpChannel->removeFile(remoteFilePath);