Skip to content

chore: Add docker compose and test services scripts #2886

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

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

Conversation

david-luna
Copy link
Contributor

@david-luna david-luna commented Jun 16, 2025

Which problem is this PR solving?

Short description of the changes

  • add docker compose file & .env file for testing
  • add script to spin up services for testing
  • move MySQL log config command from workflow to tests

@github-actions github-actions bot added pkg:instrumentation-mysql pkg:instrumentation-mysql2 pkg-status:unmaintained This package is unmaintained. Only bugfixes may be acceped until a new owner has been found. labels Jun 16, 2025
@david-luna david-luna changed the title Add docker compose and test serivces scripts chore: Add docker compose and test services scripts Jun 16, 2025
Copy link

codecov bot commented Jun 16, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.78%. Comparing base (5909ad4) to head (2c24405).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2886      +/-   ##
==========================================
+ Coverage   89.53%   89.78%   +0.25%     
==========================================
  Files         182      187       +5     
  Lines        8837     9147     +310     
  Branches     1844     1884      +40     
==========================================
+ Hits         7912     8213     +301     
- Misses        925      934       +9     

see 6 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

This package does not have an assigned component owner and is considered unmaintained. As such this package is in feature-freeze and this PR will be closed with 14 days unless a new owner or a sponsor (a member of @open-telemetry/javascript-approvers) for the feature is found. It is the responsibility of the author to find a sponsor for this feature.
Are you familiar with this package? Consider becoming a component owner.

@david-luna david-luna marked this pull request as ready for review June 18, 2025 10:16
@david-luna david-luna requested a review from a team as a code owner June 18, 2025 10:16
@@ -163,8 +163,6 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- name: Set MySQL variables
Copy link
Contributor Author

Choose a reason for hiding this comment

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

note for reviewer: this is required only for testing @opentelemetry/instrumentation-mysql and can be executed as a query using the client. Hence is removed from there and added in plugins/node/opentelemetry-instrumentation-mysql/test/mysql.test.ts

@@ -176,8 +176,6 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- name: Set MySQL variables
Copy link
Contributor Author

Choose a reason for hiding this comment

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

note for reviewer: same here

const shouldTest = process.env.RUN_MYSQL_TESTS;

before(async function () {
const connection = createConnection({
Copy link
Contributor Author

Choose a reason for hiding this comment

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

note for reviewer: enabling here the general_log setting instead of doing it in the workflows

@@ -64,7 +64,7 @@ const memoryExporter = new InMemorySpanExporter();
const CONFIG = {
user: process.env.POSTGRES_USER || 'postgres',
password: process.env.POSTGRES_PASSWORD || 'postgres',
database: process.env.POSTGRES_DB || 'postgres',
database: process.env.POSTGRES_DB || 'otel_pg_database',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

note for reviewer: align the value with the one in workflow services

@david-luna david-luna mentioned this pull request Jun 18, 2025
3 tasks
Copy link
Member

@raphael-theriault-swi raphael-theriault-swi left a comment

Choose a reason for hiding this comment

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

Love this, small nit tho.

Comment on lines +22 to +24
"test-services:start": "docker compose -f ./test/docker-compose.yaml up -d --wait",
"test-services:stop": "docker compose -f ./test/docker-compose.yaml down",
"test:with-services-config": "NODE_OPTIONS='-r dotenv/config' DOTENV_CONFIG_PATH=./test/test-services.env npm test",

Choose a reason for hiding this comment

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

This should probably use cross-env or something similar to not bail on Windows.

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.

3 participants