summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2018-07-25 17:31:31 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2018-07-25 17:31:31 +0200
commit5892cf6b29c62cc632e94b22624a0bbbe6c21c54 (patch)
tree5bd071420c3fe3c71102c427c37e952449e90131
parent58f472fa0a87d21f28d58244686b332f99d5a52c (diff)
downloadkube-5892cf6b29c62cc632e94b22624a0bbbe6c21c54.tar.gz
kube-5892cf6b29c62cc632e94b22624a0bbbe6c21c54.zip
Shutdown resources at the end of the test
to keep them from blocking the test from exiting.
-rw-r--r--tests/teststore.cpp8
-rw-r--r--tests/teststore.h1
-rw-r--r--views/accounts/tests/tst_accountsview.qml4
3 files changed, 13 insertions, 0 deletions
diff --git a/tests/teststore.cpp b/tests/teststore.cpp
index 71b19499..c69588ef 100644
--- a/tests/teststore.cpp
+++ b/tests/teststore.cpp
@@ -243,6 +243,14 @@ void TestStore::setup(const QVariantMap &map)
243 Sink::ResourceControl::flushMessageQueue(resources).exec().waitForFinished(); 243 Sink::ResourceControl::flushMessageQueue(resources).exec().waitForFinished();
244} 244}
245 245
246void TestStore::shutdownResources()
247{
248 const auto resources = Sink::Store::read<Sink::ApplicationDomain::SinkResource>({});
249 for (const auto &resource : resources) {
250 Sink::ResourceControl::shutdown(resource.identifier()).exec().waitForFinished();
251 }
252}
253
246QVariant TestStore::load(const QByteArray &type, const QVariantMap &filter) 254QVariant TestStore::load(const QByteArray &type, const QVariantMap &filter)
247{ 255{
248 using namespace Sink::ApplicationDomain; 256 using namespace Sink::ApplicationDomain;
diff --git a/tests/teststore.h b/tests/teststore.h
index 1a6a2563..4d5359a7 100644
--- a/tests/teststore.h
+++ b/tests/teststore.h
@@ -27,6 +27,7 @@ class TestStore : public QObject {
27 Q_OBJECT 27 Q_OBJECT
28public: 28public:
29 Q_INVOKABLE void setup(const QVariantMap &); 29 Q_INVOKABLE void setup(const QVariantMap &);
30 Q_INVOKABLE void shutdownResources();
30 Q_INVOKABLE QVariant load(const QByteArray &type, const QVariantMap &); 31 Q_INVOKABLE QVariant load(const QByteArray &type, const QVariantMap &);
31 Q_INVOKABLE QVariantList loadList(const QByteArray &type, const QVariantMap &); 32 Q_INVOKABLE QVariantList loadList(const QByteArray &type, const QVariantMap &);
32 Q_INVOKABLE QVariantMap read(const QVariant &); 33 Q_INVOKABLE QVariantMap read(const QVariant &);
diff --git a/views/accounts/tests/tst_accountsview.qml b/views/accounts/tests/tst_accountsview.qml
index c3b919c0..8d7bc29d 100644
--- a/views/accounts/tests/tst_accountsview.qml
+++ b/views/accounts/tests/tst_accountsview.qml
@@ -29,6 +29,10 @@ TestCase {
29 name: "AccountsView" 29 name: "AccountsView"
30 when: windowShown 30 when: windowShown
31 31
32 function cleanup() {
33 TestStore.shutdownResources();
34 }
35
32 function visitChildren(item) { 36 function visitChildren(item) {
33 console.warn(item) 37 console.warn(item)
34 for (var i = 0; i < item.children.length; i++) { 38 for (var i = 0; i < item.children.length; i++) {