Index: autotests/libs/collectionattributetest.h =================================================================== --- autotests/libs/collectionattributetest.h +++ autotests/libs/collectionattributetest.h @@ -31,7 +31,7 @@ void testAttributes(); void testDefaultAttributes(); void testCollectionRightsAttribute(); - void testCollectionIdentifcationAttribute(); + void testCollectionIdentificationAttribute(); }; #endif Index: autotests/libs/collectionattributetest.cpp =================================================================== --- autotests/libs/collectionattributetest.cpp +++ autotests/libs/collectionattributetest.cpp @@ -105,6 +105,16 @@ QFETCH(QByteArray, attr1); QFETCH(QByteArray, attr2); + struct Cleanup { + Cleanup(const Collection &col) : m_col(col) {} + ~Cleanup() { + // cleanup + CollectionDeleteJob *del = new CollectionDeleteJob(m_col); + AKVERIFYEXEC(del); + } + Collection m_col; + }; + // add a custom attribute TestAttribute *attr = new TestAttribute(); attr->deserialize(attr1); @@ -116,6 +126,7 @@ AKVERIFYEXEC(create); col = create->collection(); QVERIFY(col.isValid()); + Cleanup cleanup(col); attr = col.attribute(); QVERIFY(attr != nullptr); @@ -173,10 +184,11 @@ attr = col.attribute(); QVERIFY(attr == nullptr); - // cleanup - CollectionDeleteJob *del = new CollectionDeleteJob(col, this); - AKVERIFYEXEC(del); - + // Give the knut resource a bit of time to modify the collection and add a remote ID (after adding) + // and reparent attributes (after modifying). + // Otherwise we can delete it faster than it can do that, and we end up with a confusing warning + // "No such collection" from the resource's modify job. + QTest::qWait(100); // ideally we'd loop over "fetch and check there's a remote id" } void CollectionAttributeTest::testDefaultAttributes() @@ -213,7 +225,7 @@ } } -void CollectionAttributeTest::testCollectionIdentifcationAttribute() +void CollectionAttributeTest::testCollectionIdentificationAttribute() { QByteArray id("identifier"); QByteArray ns("namespace");