Skip to content

Conversation

@kikoveiga
Copy link
Contributor

@kikoveiga kikoveiga commented Nov 18, 2025

What does this PR do?

  • Replaces all System.currentTimeMillis() and System.nanoTime() calls with TimeProvider interface calls.
  • Improves and optimizes some tests by replacing Thread.sleep calls with fake timestamps using a mockTimeProvider.

Motivation

  • Static calls are not mockable. Using an interface is better for injecting mock implementations and general testability.

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Make sure you discussed the feature or bugfix with the maintaining team in an Issue
  • Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)

@kikoveiga kikoveiga self-assigned this Nov 18, 2025
@codecov-commenter
Copy link

codecov-commenter commented Nov 18, 2025

Codecov Report

❌ Patch coverage is 88.55721% with 23 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.23%. Comparing base (f786365) to head (8db5d89).

Files with missing lines Patch % Lines
...adog/android/internal/profiler/DDExecutionTimer.kt 0.00% 3 Missing ⚠️
...ava/com/datadog/trace/util/AgentTaskScheduler.java 0.00% 3 Missing ⚠️
...tadog/android/internal/profiler/GlobalBenchmark.kt 0.00% 2 Missing ⚠️
.../com/datadog/android/internal/time/TimeProvider.kt 0.00% 2 Missing ⚠️
...dog/android/rum/resource/RumResourceInputStream.kt 75.00% 0 Missing and 2 partials ⚠️
...nternal/recorder/listener/WindowsOnDrawListener.kt 0.00% 2 Missing ⚠️
...ace/core/scopemanager/ContinuableScopeManager.java 0.00% 2 Missing ⚠️
...n/com/datadog/android/core/internal/CoreFeature.kt 87.50% 1 Missing ⚠️
.../android/core/internal/logger/SdkInternalLogger.kt 50.00% 0 Missing and 1 partial ⚠️
...e/internal/thread/ObservableLinkedBlockingQueue.kt 66.67% 1 Missing ⚠️
... and 4 more
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3011      +/-   ##
===========================================
+ Coverage    71.17%   71.23%   +0.06%     
===========================================
  Files          859      860       +1     
  Lines        31444    31512      +68     
  Branches      5302     5304       +2     
===========================================
+ Hits         22378    22446      +68     
- Misses        7555     7565      +10     
+ Partials      1511     1501      -10     
Files with missing lines Coverage Δ
.../com/datadog/android/api/feature/FeatureSdkCore.kt 33.33% <ø> (ø)
...n/com/datadog/android/core/internal/DatadogCore.kt 78.26% <100.00%> (+0.07%) ⬆️
...tadog/android/core/internal/NoOpInternalSdkCore.kt 9.00% <100.00%> (+0.92%) ⬆️
...in/com/datadog/android/core/internal/SdkFeature.kt 90.00% <100.00%> (+0.09%) ⬆️
...d/core/internal/data/upload/RotatingDnsResolver.kt 92.31% <100.00%> (+0.64%) ⬆️
...id/core/internal/metrics/BatchMetricsDispatcher.kt 94.59% <100.00%> (ø)
...oid/core/internal/metrics/MethodCalledTelemetry.kt 100.00% <100.00%> (ø)
...sistence/file/advanced/ConsentAwareFileMigrator.kt 80.85% <100.00%> (-0.54%) ⬇️
...rsistence/file/advanced/FeatureFileOrchestrator.kt 100.00% <100.00%> (ø)
...stence/file/advanced/MoveDataMigrationOperation.kt 100.00% <100.00%> (ø)
... and 58 more

... and 31 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@datadog-official
Copy link

datadog-official bot commented Nov 20, 2025

🎯 Code Coverage
Patch Coverage: 100.00%
Total Coverage: 71.34% (-0.00%)

View detailed report

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 8db5d89 | Docs | Datadog PR Page | Was this helpful? Give us feedback!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants