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

[mongodbreceiver] Fix get mongodb version #27442

Conversation

gsanchezgavier
Copy link
Contributor

Description:

  • Improve the unit-test to catch similar errors in the future.
  • Fix mongodb version collection.

Link to tracking Issue:
#27441
Testing:
Added the expectation assert for the Mock.
This is the log output from running the tests in the first catching the bug

--- FAIL: TestScraperScrape (0.00s)
    --- FAIL: TestScraperScrape/Failed_to_fetch_database_names (0.00s)
        pathTo/opentelemetry-collector-contrib/receiver/mongodbreceiver/scraper_test.go:316: FAIL:	GetVersion(string)
            		at: [pathTo/opentelemetry-collector-contrib/receiver/mongodbreceiver/scraper_test.go:146 pathTo/opentelemetry-collector-contrib/receiver/mongodbreceiver/scraper_test.go:292]
        pathTo/opentelemetry-collector-contrib/receiver/mongodbreceiver/scraper_test.go:316: PASS:	ListDatabaseNames(string,string,string)
        pathTo/opentelemetry-collector-contrib/receiver/mongodbreceiver/scraper_test.go:316: FAIL: 1 out of 2 expectation(s) were met.
            	The code you are testing needs to make 1 more call(s).
            	at: [pathTo/opentelemetry-collector-contrib/receiver/mongodbreceiver/scraper_test.go:316]

Documentation:

@djaglowski djaglowski merged commit dcca7d3 into open-telemetry:main Oct 6, 2023
82 checks passed
@github-actions github-actions bot added this to the next release milestone Oct 6, 2023
jmsnll pushed a commit to jmsnll/opentelemetry-collector-contrib that referenced this pull request Nov 12, 2023
**Description:** <Describe what has changed.>
- Improve the unit-test to catch similar errors in the future. 
- Fix mongodb version collection. 

**Link to tracking Issue:** <Issue number if applicable>
open-telemetry#27441 
**Testing:** <Describe what testing was performed and which tests were
added.>
Added the expectation assert for the Mock. 
This is the log output from running the tests in the first catching the
bug
```
--- FAIL: TestScraperScrape (0.00s)
    --- FAIL: TestScraperScrape/Failed_to_fetch_database_names (0.00s)
        pathTo/opentelemetry-collector-contrib/receiver/mongodbreceiver/scraper_test.go:316: FAIL:	GetVersion(string)
            		at: [pathTo/opentelemetry-collector-contrib/receiver/mongodbreceiver/scraper_test.go:146 pathTo/opentelemetry-collector-contrib/receiver/mongodbreceiver/scraper_test.go:292]
        pathTo/opentelemetry-collector-contrib/receiver/mongodbreceiver/scraper_test.go:316: PASS:	ListDatabaseNames(string,string,string)
        pathTo/opentelemetry-collector-contrib/receiver/mongodbreceiver/scraper_test.go:316: FAIL: 1 out of 2 expectation(s) were met.
            	The code you are testing needs to make 1 more call(s).
            	at: [pathTo/opentelemetry-collector-contrib/receiver/mongodbreceiver/scraper_test.go:316]
```
**Documentation:** <Describe the documentation added.>
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.

4 participants