Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ea20bffe authored by Bookatz's avatar Bookatz
Browse files

Fix statsd_test TestOnDumpReportEraseData

After erasing the statsd data, allow statsd to have an empty report, or
even a report with a non-empty metrics wrapper, as long as it doesn't
have any of the former count metrics in it.

Bug: 77909781
Test: make -j8 statsd_test && adb sync data && adb shell data/nativetest64/statsd_test/statsd_test
Change-Id: I525c61aea97a185df8916e4c1b4c4118493ed780
parent 67fb3ca9
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -279,7 +279,10 @@ TEST(StatsLogProcessorTest, TestOnDumpReportEraseData) {
    // Dump report again. There should be no data since we erased it.
    processor->onDumpReport(cfgKey, 5, true, true /* DO erase data. */, ADB_DUMP, &bytes);
    output.ParseFromArray(bytes.data(), bytes.size());
    bool noData = (output.reports_size() == 0) || (output.reports(0).metrics_size() == 0);
    // We don't care whether statsd has a report, as long as it has no count metrics in it.
    bool noData = output.reports_size() == 0
            || output.reports(0).metrics_size() == 0
            || output.reports(0).metrics(0).count_metrics().data_size() == 0;
    EXPECT_TRUE(noData);
}