This is a unit test setup error.
Every unit-test uses the same instance of FB_SparkPlugB_SimpleEncoder.
They use a case statement to perform parts of the tests on different scans.
so for example:
1. Test_EncoderWithSimpleMetricBool will on the first scan Init the encoder and add metric
2. Test_EncoderWithList will on the second scan Init the encoder and add metrics
3. Then Test_EncoderWithSimpleMetricBool will on the second scan Encode
From this, it can be seen that the encoding at 3 has nothing to do with the metrics added at 1 (because in the mean time, some other unit test has Init and added metrics.
Possible solution:
Every unit test has its own Encoder and own metrics. If we want to test "does it encode a second time?" then a specific and segregated test for that should be given.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Just some remarks:
It seems a shared master metrics list in between tests is also an issue.
To further compartmentalize the tests, we should declare separate Master Metrics Lists on a 'per test basis'.
My personal thoughts are to suffice with a list of 1 instance per simpletype in masterlist (so its currently 15/16 metrics in size). Offcourse tests with more metrics should have a bigger list.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This is a unit test setup error.
Every unit-test uses the same instance of FB_SparkPlugB_SimpleEncoder.
They use a case statement to perform parts of the tests on different scans.
so for example:
1. Test_EncoderWithSimpleMetricBool will on the first scan Init the encoder and add metric
2. Test_EncoderWithList will on the second scan Init the encoder and add metrics
3. Then Test_EncoderWithSimpleMetricBool will on the second scan Encode
From this, it can be seen that the encoding at 3 has nothing to do with the metrics added at 1 (because in the mean time, some other unit test has Init and added metrics.
Possible solution:
Every unit test has its own Encoder and own metrics. If we want to test "does it encode a second time?" then a specific and segregated test for that should be given.
moving the FB declaration(s) to the method itself in VAR_STAT
Tests silo'ed with positive outcome.
Stumbled upon a side effect (re-open corresponding ticket?).
EncodeMetricsList_Test encounters a 'payloadnotenoughmetrics' error while adding a list of 1024 metrics.
solved with [r318].
Further segregated the resources between unit tests.
Just some remarks:
It seems a shared master metrics list in between tests is also an issue.
To further compartmentalize the tests, we should declare separate Master Metrics Lists on a 'per test basis'.
My personal thoughts are to suffice with a list of 1 instance per simpletype in masterlist (so its currently 15/16 metrics in size). Offcourse tests with more metrics should have a bigger list.