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

Commit cc884dfc authored by Yao Chen's avatar Yao Chen
Browse files

Fix partial bucket unit tests.

Bug: 79347749
Test: statsd_test
Change-Id: I69eee7172d6fe4ce895530f089193eb08653e269
parent fd3b398e
Loading
Loading
Loading
Loading
+16 −16
Original line number Diff line number Diff line
@@ -110,7 +110,7 @@ StatsdConfig MakeGaugeMetricConfig(int64_t minTime) {
TEST(PartialBucketE2eTest, TestCountMetricWithoutSplit) {
    StatsService service(nullptr);
    SendConfig(service, MakeConfig());
    const long start = getElapsedRealtimeNs();  // This is the start-time the metrics producers are
    int64_t start = getElapsedRealtimeNs();  // This is the start-time the metrics producers are
                                             // initialized with.

    service.mProcessor->OnLogEvent(CreateAppCrashEvent(100, start + 1).get());
@@ -124,7 +124,7 @@ TEST(PartialBucketE2eTest, TestCountMetricWithoutSplit) {
TEST(PartialBucketE2eTest, TestCountMetricNoSplitOnNewApp) {
    StatsService service(nullptr);
    SendConfig(service, MakeConfig());
    const long start = getElapsedRealtimeNs();  // This is the start-time the metrics producers are
    int64_t start = getElapsedRealtimeNs();  // This is the start-time the metrics producers are
                                             // initialized with.

    // Force the uidmap to update at timestamp 2.
@@ -142,7 +142,7 @@ TEST(PartialBucketE2eTest, TestCountMetricNoSplitOnNewApp) {
TEST(PartialBucketE2eTest, TestCountMetricSplitOnUpgrade) {
    StatsService service(nullptr);
    SendConfig(service, MakeConfig());
    const long start = getElapsedRealtimeNs();  // This is the start-time the metrics producers are
    int64_t start = getElapsedRealtimeNs();  // This is the start-time the metrics producers are
                                             // initialized with.
    service.mUidMap->updateMap(start, {1}, {1}, {String16(kApp1.c_str())});

@@ -165,7 +165,7 @@ TEST(PartialBucketE2eTest, TestCountMetricSplitOnUpgrade) {
TEST(PartialBucketE2eTest, TestCountMetricSplitOnRemoval) {
    StatsService service(nullptr);
    SendConfig(service, MakeConfig());
    const long start = getElapsedRealtimeNs();  // This is the start-time the metrics producers are
    int64_t start = getElapsedRealtimeNs();  // This is the start-time the metrics producers are
                                             // initialized with.
    service.mUidMap->updateMap(start, {1}, {1}, {String16(kApp1.c_str())});

@@ -190,7 +190,7 @@ TEST(PartialBucketE2eTest, TestValueMetricWithoutMinPartialBucket) {
    // Partial buckets don't occur when app is first installed.
    service.mUidMap->updateApp(1, String16(kApp1.c_str()), 1, 1);
    SendConfig(service, MakeValueMetricConfig(0));
    const long start = getElapsedRealtimeNs();  // This is the start-time the metrics producers are
    int64_t start = getElapsedRealtimeNs();  // This is the start-time the metrics producers are
                                             // initialized with.

    service.mProcessor->informPullAlarmFired(5 * 60 * NS_PER_SEC + start);
@@ -207,7 +207,7 @@ TEST(PartialBucketE2eTest, TestValueMetricWithMinPartialBucket) {
    // Partial buckets don't occur when app is first installed.
    service.mUidMap->updateApp(1, String16(kApp1.c_str()), 1, 1);
    SendConfig(service, MakeValueMetricConfig(60 * NS_PER_SEC /* One minute */));
    const long start = getElapsedRealtimeNs();  // This is the start-time the metrics producers are
    int64_t start = getElapsedRealtimeNs();  // This is the start-time the metrics producers are
                                             // initialized with.

    const int64_t endSkipped = 5 * 60 * NS_PER_SEC + start + 2;
@@ -230,7 +230,7 @@ TEST(PartialBucketE2eTest, TestGaugeMetricWithoutMinPartialBucket) {
    // Partial buckets don't occur when app is first installed.
    service.mUidMap->updateApp(1, String16(kApp1.c_str()), 1, 1);
    SendConfig(service, MakeGaugeMetricConfig(0));
    const long start = getElapsedRealtimeNs();  // This is the start-time the metrics producers are
    int64_t start = getElapsedRealtimeNs();  // This is the start-time the metrics producers are
                                             // initialized with.

    service.mProcessor->informPullAlarmFired(5 * 60 * NS_PER_SEC + start);
@@ -247,7 +247,7 @@ TEST(PartialBucketE2eTest, TestGaugeMetricWithMinPartialBucket) {
    // Partial buckets don't occur when app is first installed.
    service.mUidMap->updateApp(1, String16(kApp1.c_str()), 1, 1);
    SendConfig(service, MakeGaugeMetricConfig(60 * NS_PER_SEC /* One minute */));
    const long start = getElapsedRealtimeNs();  // This is the start-time the metrics producers are
    int64_t start = getElapsedRealtimeNs();  // This is the start-time the metrics producers are
                                             // initialized with.

    const int64_t endSkipped = 5 * 60 * NS_PER_SEC + start + 2;