DataDog / dd-sdk-android-gradle-plugin

The Datadog Gradle Plugin for Android
Apache License 2.0
14 stars 9 forks source link

RUM-4374: Emulate upload network call for functional tests #255

Closed 0xnm closed 6 months ago

0xnm commented 6 months ago

What does this PR do?

Right now we are calling the real intake for the functional tests of Gradle Plugin, and since we don’t have a real API key, we get an error and we expect build failure in our tests. However, it may be some other build failures, so it is handy to emulate network call to make test expectation without any build failures.

This PR adds build parameter dd-emulate-upload-call which can be passed for the build script execution. If it is present, no real network call will be made and we will create a fake response.

Review checklist (to be filled by reviewers)

codecov-commenter commented 6 months ago

Codecov Report

Attention: Patch coverage is 33.33333% with 10 lines in your changes are missing coverage. Please review.

Project coverage is 80.78%. Comparing base (b1ee483) to head (c3626c4).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #255 +/- ## ============================================= - Coverage 81.48% 80.78% -0.70% - Complexity 203 205 +2 ============================================= Files 26 26 Lines 810 822 +12 Branches 104 105 +1 ============================================= + Hits 660 664 +4 - Misses 112 121 +9 + Partials 38 37 -1 ``` | [Files](https://app.codecov.io/gh/DataDog/dd-sdk-android-gradle-plugin/pull/255?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog) | Coverage Δ | | |---|---|---| | [...tlin/com/datadog/gradle/plugin/DdFileUploadTask.kt](https://app.codecov.io/gh/DataDog/dd-sdk-android-gradle-plugin/pull/255?src=pr&el=tree&filepath=dd-sdk-android-gradle-plugin%2Fsrc%2Fmain%2Fkotlin%2Fcom%2Fdatadog%2Fgradle%2Fplugin%2FDdFileUploadTask.kt&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog#diff-ZGQtc2RrLWFuZHJvaWQtZ3JhZGxlLXBsdWdpbi9zcmMvbWFpbi9rb3RsaW4vY29tL2RhdGFkb2cvZ3JhZGxlL3BsdWdpbi9EZEZpbGVVcGxvYWRUYXNrLmt0) | `82.54% <80.00%> (+1.09%)` | :arrow_up: | | [...lin/com/datadog/gradle/plugin/internal/Uploader.kt](https://app.codecov.io/gh/DataDog/dd-sdk-android-gradle-plugin/pull/255?src=pr&el=tree&filepath=dd-sdk-android-gradle-plugin%2Fsrc%2Fmain%2Fkotlin%2Fcom%2Fdatadog%2Fgradle%2Fplugin%2Finternal%2FUploader.kt&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog#diff-ZGQtc2RrLWFuZHJvaWQtZ3JhZGxlLXBsdWdpbi9zcmMvbWFpbi9rb3RsaW4vY29tL2RhdGFkb2cvZ3JhZGxlL3BsdWdpbi9pbnRlcm5hbC9VcGxvYWRlci5rdA==) | `72.73% <0.00%> (-27.27%)` | :arrow_down: | | [...m/datadog/gradle/plugin/internal/OkHttpUploader.kt](https://app.codecov.io/gh/DataDog/dd-sdk-android-gradle-plugin/pull/255?src=pr&el=tree&filepath=dd-sdk-android-gradle-plugin%2Fsrc%2Fmain%2Fkotlin%2Fcom%2Fdatadog%2Fgradle%2Fplugin%2Finternal%2FOkHttpUploader.kt&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog#diff-ZGQtc2RrLWFuZHJvaWQtZ3JhZGxlLXBsdWdpbi9zcmMvbWFpbi9rb3RsaW4vY29tL2RhdGFkb2cvZ3JhZGxlL3BsdWdpbi9pbnRlcm5hbC9Pa0h0dHBVcGxvYWRlci5rdA==) | `78.20% <12.50%> (-4.34%)` | :arrow_down: | ... and [1 file with indirect coverage changes](https://app.codecov.io/gh/DataDog/dd-sdk-android-gradle-plugin/pull/255/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=DataDog)