[kioslave/desktop] Attempt at making test more robust
ClosedPublic

Authored by davidedmundson on Mar 21 2020, 3:08 PM.

Details

Summary

We have an unstable test.
KCoreDirLister has a timer involved set to 200ms

QTRY_VERIFY will fire when we have one change from the spy, but maybe
not everything if we explicitly wait and process maybe it will improve
things?

It's a bit of a random shot-in the dark.

Test Plan

Passes locally..but it always passed locally before

Diff Detail

Repository
R120 Plasma Workspace
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
davidedmundson created this revision.Mar 21 2020, 3:08 PM
Restricted Application added a project: Plasma. · View Herald TranscriptMar 21 2020, 3:08 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
davidedmundson requested review of this revision.Mar 21 2020, 3:08 PM

In theory QTRY_VERIFY should wait up to 5 seconds until condition is met. qWait(250) shouldn't change much...

In theory QTRY_VERIFY should wait up to 5 seconds until condition is met. qWait(250) shouldn't change much...

The big difference is that before if one spyFilesAdded is emitted after say 10ms, we'll continue immediately on with the test

Whereas now we'll always wait 250ms
spyFilesAdded could have been emitted 1 or 3 times as per the comment on the next line by then

davidedmundson added a comment.EditedMar 21 2020, 4:10 PM

The failure was always on this line:

QCOMPARE(fileItem.targetUrl(), QUrl::fromLocalFile(destFilePath));

The failure was always on this line:

QCOMPARE(fileItem.targetUrl(), QUrl::fromLocalFile(destFilePath));

Oh, I see. So maybe this:
QTRY_COMPARE_WITH_TIMEOUT(fileItem.targetUrl(), QUrl::fromLocalFile(destFilePath), 250)
?

That won't work as is because I would need to re-run

const KFileItem fileItem = lister->findByUrl(destUrl);
kmaterka accepted this revision.Mar 21 2020, 6:37 PM

That won't work as is because I would need to re-run

const KFileItem fileItem = lister->findByUrl(destUrl);

I knew there had to be a catch, it would be too easy...

Probably the best would be to make KDirNotify consistent, but probably that's not that easy. OK, one small wait won't kill the world, right? :)

This revision is now accepted and ready to land.Mar 21 2020, 6:37 PM
This revision was automatically updated to reflect the committed changes.

OK, one small wait won't kill the world, right? :)

Not in a unit test.
If it ends up not making a difference I'll revert.

..it made no difference