Test configId in TestSerializer
Needs ReviewPublic

Authored by gladhorn on Jul 25 2018, 11:15 AM.

Details

Reviewers
romangg
Group Reviewers
Plasma
Summary

The configId is the file name under which the config is stored. When it
changes or is not deterministic, we will not be able to restore the user
settings. The hashing must be stable (and seems to be), but since there
were reports lately that e.g. rotation is not correctly stored/loaded,
it makes sense to test that this is not the cause.

Diff Detail

Repository
R104 KScreen
Branch
arcpatch-D14364
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 1224
Build 1238: arc lint + arc unit
gladhorn created this revision.Jul 25 2018, 11:15 AM
Restricted Application added a project: Plasma. · View Herald TranscriptJul 25 2018, 11:15 AM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
gladhorn requested review of this revision.Jul 25 2018, 11:15 AM
romangg requested changes to this revision.Jul 26 2018, 11:32 AM
romangg added a subscriber: romangg.
romangg added inline comments.
tests/kded/serializertest.cpp
127

How did you find this config id and the one below out? Pls add a comment how these magic numbers relate to the json files and how you obtained them from the json files.

This revision now requires changes to proceed.Jul 26 2018, 11:32 AM
gladhorn updated this revision to Diff 38518.Jul 26 2018, 4:45 PM
gladhorn edited the summary of this revision. (Show Details)

Add more explanations

romangg added inline comments.Jul 27 2018, 8:48 AM
tests/kded/serializertest.cpp
163

Below we do some tests in regards to the current config id value. These tests are unrelated to any changes of the config id value over time. Therefore it should not reference the magic config id value.

Replace the above two lines with:

auto configId = Serializer::configId(config);

// check that this config id value is unchanged from previous versions of this software
QCOMPARE(configId, QLatin1String("8684e883209d7644eb76feea2081c431");

Rest below unchanged in this function. Same in additions to function testRotatedScreenConfig.

gladhorn added inline comments.Jul 27 2018, 9:22 AM
tests/kded/serializertest.cpp
163

I was hoping the comment above is enough, repeated explanations are not that sensible either in my opinion. I need the constant configId to compare against it later, the point is to confirm that the configId is independent of the order of outputs in the hash for example.

romangg added inline comments.Jul 27 2018, 10:32 AM
tests/kded/serializertest.cpp
163

You can leave the comment out if you want to.

My core "complain" is this: In your code the line 163

QCOMPARE(Serializer::configId(config), configId);

checks, that the config file names stay the same. For that it compares the config id value at the time the test is run to a static one, which you have fixated at an arbitrary point in time (which was when you wrote this change). This test is to make sure, that config id value stays the same over time.

Below you have in line 172 again a comparison. But this time it makes sure that on changes to output ids the config id stays the same. This is not dependent on how the static value was at the time you wrote the patch but only on the value of the current one when the test is run.

For example the current value when the test is run could become different to the fixated one. But the current value should (and could) still be constant over output id changes. Of course this does not influence the result of the test, because it fails already above in this case. But in theory it makes more sense to compare config ids on output id changes in regards to a variable holding the config id value when the test is run instead of comparing it with the fixated one.

zzag added a subscriber: zzag.Feb 6 2019, 12:22 PM

Any updates?