Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance googlecloudmonitoringreceiver: Add Unit Tests for Metric Conversion and Improve Edge Case Coverage #36846

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

scaletech-milan
Copy link

@scaletech-milan scaletech-milan commented Dec 16, 2024

Description:
Added comprehensive test cases for the entire Google Cloud Monitoring Receiver component.

Link to tracking Issue:
#36815

Testing:
Implemented test cases to validate:

  • GCP Monitoring client connection.
  • OpenTelemetry's built-in functions.
  • Scraping logic.
  • Metric conversion functions.

Documentation:
N/A

- Added unit tests for validating metric conversion logic in googlecloudmonitoringreceiver
- Improved test coverage for edge cases in the receiver component
Copy link

linux-foundation-easycla bot commented Dec 16, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

Copy link
Contributor

@dashpole dashpole left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good overall. Lets just make the tests less fragile.

receiver/googlecloudmonitoringreceiver/receiver_test.go Outdated Show resolved Hide resolved
receiver/googlecloudmonitoringreceiver/receiver_test.go Outdated Show resolved Hide resolved
receiver/googlecloudmonitoringreceiver/receiver_test.go Outdated Show resolved Hide resolved
receiver/googlecloudmonitoringreceiver/receiver_test.go Outdated Show resolved Hide resolved
receiver/googlecloudmonitoringreceiver/receiver_test.go Outdated Show resolved Hide resolved
- Update testify error handling code
- Add sample serviceAccount.json inside testdata
@scaletech-milan
Copy link
Author

Updated all the changes

@dashpole
Copy link
Contributor

Looks good. Just needs the CLA signed, and I think we are good to go

@scaletech-milan
Copy link
Author

Looks good. Just needs the CLA signed, and I think we are good to go

i already proceed for CLA sign, waiting for approval.

@dashpole
Copy link
Contributor

- Resolve make lint issues
@scaletech-milan
Copy link
Author

Can you please check now @dashpole

@dashpole
Copy link
Contributor

Run make checkapi
  make checkapi
  shell: /usr/bin/bash -e {0}
  env:
    TEST_RESULTS: testbed/tests/results/junit/results.xml
    SEGMENT_DOWNLOAD_TIMEOUT_MINS: [2](https://github.com/open-telemetry/opentelemetry-collector-contrib/actions/runs/12414428726/job/34674820908?pr=36846#step:10:2)
go run cmd/checkapi/main.go .
Ignoring extension/observer per allowlist
Ignoring extension/opampcustommessages per allowlist
202[4](https://github.com/open-telemetry/opentelemetry-collector-contrib/actions/runs/12414428726/job/34674820908?pr=36846#step:10:4)/12/19 19:28:44 receiver/googlecloudmonitoringreceiver has more than one function: "NewFactory,NewFakeMetricTestServer"

Consider making NewFakeMetricTestServer and other testing-related artifacts not exported (lowercase)

Copy link

codecov bot commented Dec 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.86%. Comparing base (defc07b) to head (ded4121).
Report is 43 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #36846      +/-   ##
==========================================
+ Coverage   79.72%   79.86%   +0.13%     
==========================================
  Files        2218     2218              
  Lines      209156   209252      +96     
==========================================
+ Hits       166749   167118     +369     
+ Misses      36836    36557     -279     
- Partials     5571     5577       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@scaletech-milan
Copy link
Author

@TylerHelmuth @dashpole
Can you please give workflow approval ?

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

Successfully merging this pull request may close these issues.

2 participants