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

[receiver/sqlquery] sqlserver integration tests, improved coverage #36922

Merged

Conversation

Grandys
Copy link
Contributor

@Grandys Grandys commented Dec 22, 2024

Description

Mainly added test for sqlserver, plus added coverage for logs (as requested in comment)

Link to tracking issue

Fixes #29695

Testing

Main changes:

  • Added metrics tests for SqlServer
  • Covered MySql, SqlServer and Oracle for logs

Improvements:

  • To avoid repetitions, changed approach to "parameterized" tests - run the same test flow for different database engines (for logs only).
  • Do not hardcode "localhost" and host port, get these values from testcontainers.
  • Replaced inserting test values into the database from running CLI commands in the container to executing SQL commands.
  • Updated Oracle init script to use otel schema instead of sys.

Important: For Oracle and SQL Server, tests are skipped (tested locally) - I expect them to fail due to #27577 (which was not fixed but closed due to inactivity).

@Grandys Grandys requested review from dmitryax, crobert-1 and a team as code owners December 22, 2024 21:42
@github-actions github-actions bot added the receiver/sqlquery SQL query receiver label Dec 22, 2024
@songy23 songy23 added the Run Windows Enable running windows test on a PR label Dec 23, 2024
@Grandys Grandys force-pushed the sqlqueryreciver-improve-integration-tests branch from 2c462cc to 1bdd23c Compare December 23, 2024 14:12
Copy link

linux-foundation-easycla bot commented Dec 23, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

@Grandys Grandys force-pushed the sqlqueryreciver-improve-integration-tests branch 3 times, most recently from dc3dc6e to 1bdd23c Compare December 23, 2024 17:53
@Grandys Grandys force-pushed the sqlqueryreciver-improve-integration-tests branch from 3044d01 to bba41e4 Compare December 31, 2024 14:28
BodyColumn: "body",
AttributeColumns: []string{"attribute"},
},
type DbEngine struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

I would inexpert that type just to be clear about it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@atoulme Thank you for your comment. I'm not entirely clear on what you mean. Are you suggesting that I should simply rename this type to DbEngineUnderTest?

@Grandys Grandys requested a review from atoulme January 4, 2025 12:16
@Grandys Grandys force-pushed the sqlqueryreciver-improve-integration-tests branch from bba41e4 to da67353 Compare January 4, 2025 15:20
@crobert-1 crobert-1 added the Skip Changelog PRs that do not require a CHANGELOG.md entry label Jan 6, 2025
@crobert-1
Copy link
Member

Failing extension test is frequency of #37079, I've added a reference there. Unrelated to this change.

@Grandys Grandys force-pushed the sqlqueryreciver-improve-integration-tests branch from da67353 to 49d5e36 Compare January 9, 2025 22:18
Copy link
Contributor

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Jan 24, 2025
@Grandys Grandys force-pushed the sqlqueryreciver-improve-integration-tests branch from 49d5e36 to 272c41a Compare January 26, 2025 21:49
@Grandys Grandys force-pushed the sqlqueryreciver-improve-integration-tests branch from 272c41a to b0efb0d Compare January 26, 2025 22:48
@github-actions github-actions bot removed the Stale label Jan 27, 2025
@Grandys Grandys requested a review from crobert-1 January 27, 2025 07:32
@Grandys
Copy link
Contributor Author

Grandys commented Jan 27, 2025

@crobert-1 @atoulme
Could you re-review my PR?

@crobert-1 crobert-1 added the ready to merge Code review completed; ready to merge by maintainers label Jan 29, 2025
@songy23 songy23 merged commit ac0f08e into open-telemetry:main Jan 29, 2025
242 checks passed
@github-actions github-actions bot added this to the next release milestone Jan 29, 2025
@Grandys Grandys deleted the sqlqueryreciver-improve-integration-tests branch January 29, 2025 20:23
chengchuanpeng pushed a commit to chengchuanpeng/opentelemetry-collector-contrib that referenced this pull request Feb 8, 2025
…pen-telemetry#36922)

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

Mainly added test for sqlserver, plus added coverage for logs (as
requested in
[comment](open-telemetry#35195 (review)))

<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Fixes open-telemetry#29695

<!--Describe what testing was performed and which tests were added.-->
#### Testing
Main changes:
* Added metrics tests for SqlServer
* Covered MySql, SqlServer and Oracle for logs

Improvements:

- To avoid repetitions, changed approach to "parameterized" tests - run
the same test flow for different database engines (for logs only).
- Do not hardcode "localhost" and host port, get these values from
testcontainers.
- Replaced inserting test values into the database from running CLI
commands in the container to executing SQL commands.
- Updated Oracle init script to use `otel` schema instead of `sys`.

Important: For Oracle and SQL Server, tests are **skipped** (tested
locally) - I expect them to fail due to open-telemetry#27577 (which was not fixed but
closed due to inactivity).
<!--Describe the documentation added.-->
<!--Please delete paragraphs that you did not use before submitting.-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready to merge Code review completed; ready to merge by maintainers receiver/sqlquery SQL query receiver Run Windows Enable running windows test on a PR Skip Changelog PRs that do not require a CHANGELOG.md entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sqlqueryreceiver lacks integration tests for mssql
5 participants