diff --git a/plugins/docker/tests/test_docker.cpp b/plugins/docker/tests/test_docker.cpp index 2ce4f82dd..7810bf9eb 100644 --- a/plugins/docker/tests/test_docker.cpp +++ b/plugins/docker/tests/test_docker.cpp @@ -1,116 +1,119 @@ /*************************************************************************** * This file was partly taken from KDevelop's cvs plugin * * Copyright 2017 Aleix Pol Gonzalez * * * * This program is free software; you can redistribute it and/or * * modify it under the terms of the GNU General Public License as * * published by the Free Software Foundation; either version 2 of * * the License or (at your option) version 3 or any later version * * accepted by the membership of KDE e.V. (or its successor approved * * by the membership of KDE e.V.), which shall act as a proxy * * defined in Section 14 of version 3 of the license. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program. If not, see . * ***************************************************************************/ #include #include #include #include #include #include #include #include #include #include using namespace KDevelop; static QString s_testedImage = QStringLiteral("ubuntu:17.04"); class DockerTest: public QObject { Q_OBJECT public: DockerTest() { - QLoggingCategory::setFilterRules(QStringLiteral("*.debug=false\ndefault.debug=true\nkdevelop.projectmanagers.cmake.debug=true\n")); + QLoggingCategory::setFilterRules(QStringLiteral("*.debug=false\ndefault.debug=true\nkdevplatform.plugins.docker=true\n")); auto ret = QProcess::execute("docker", {"pull", s_testedImage}); - Q_ASSERT(ret == 0); + if (ret != 0) { + QSKIP("Couldn't successfully call docker"); + return; + } AutoTestShell::init({QStringLiteral("kdevdocker")}); TestCore::initialize(); m_initialRuntime = ICore::self()->runtimeController()->currentRuntime(); auto plugin = ICore::self()->pluginController()->loadPlugin("kdevdocker"); Q_ASSERT(plugin); QSignalSpy spy(plugin, SIGNAL(imagesListed())); Q_ASSERT(spy.wait()); auto projectPath = QUrl::fromLocalFile(QFINDTESTDATA("testproject/test.kdev4")); qDebug() << "wuuu" << projectPath; TestCore::self()->projectController()->openProject(projectPath); QSignalSpy spy2(TestCore::self()->projectController(), &IProjectController::projectOpened); Q_ASSERT(spy2.wait()); } IRuntime* m_initialRuntime; private Q_SLOTS: void initTestCase() { QVERIFY(ICore::self()->runtimeController()->currentRuntime() == m_initialRuntime); for(IRuntime* runtime : ICore::self()->runtimeController()->availableRuntimes()) { if (s_testedImage == runtime->name()) { ICore::self()->runtimeController()->setCurrentRuntime(runtime); } } QVERIFY(ICore::self()->runtimeController()->currentRuntime() != m_initialRuntime); } void paths() { auto rt = ICore::self()->runtimeController()->currentRuntime(); QVERIFY(rt); const Path root("/"); const Path hostDir = rt->pathInHost(root); QCOMPARE(root, rt->pathInRuntime(hostDir)); } void projectPath() { auto rt = ICore::self()->runtimeController()->currentRuntime(); QVERIFY(rt); auto project = ICore::self()->projectController()->projects().first(); QVERIFY(project); const Path file = project->projectFile(); QCOMPARE(file, rt->pathInRuntime(rt->pathInHost(file))); QCOMPARE(project->path(), rt->pathInHost(rt->pathInRuntime(project->path()))); } void envs() { auto rt = ICore::self()->runtimeController()->currentRuntime(); QVERIFY(rt); QCOMPARE(rt->getenv("PATH"), QByteArray("/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin")); } void cleanupTestCase() { ICore::self()->runtimeController()->setCurrentRuntime(m_initialRuntime); } }; QTEST_MAIN( DockerTest ) #include "test_docker.moc"