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

[internal] improve local testing experience #2038

Open
2 of 12 tasks
pichlermarc opened this issue Mar 25, 2024 · 4 comments · May be fixed by #2214
Open
2 of 12 tasks

[internal] improve local testing experience #2038

pichlermarc opened this issue Mar 25, 2024 · 4 comments · May be fixed by #2214
Labels
needs:code-contribution This feature/bug is ready to implement type:feature-tracking A feature with sub-issues that need to be addressed up-for-grabs Good for taking. Extra help will be provided by maintainers

Comments

@pichlermarc
Copy link
Member

pichlermarc commented Mar 25, 2024

A lot of the tests in this repository require some dependencies to run (postgres, mysql, redis).

By default, we skip a lot of tests since these dependencies need to be spun up manually. Usually, to run them locally an env var needs to be set that prevents these tests from being skipped. Unfortunately this is currently inconsistent across packages.

The goal of this issue is to streamline the testing setup and ensure scripts behave the same in each package, and add missing scripts if necessary:

  • test:docker:start
    • spins up one or more docker containers which are used for testing, mapping ports if necessary
  • test:docker:stop
    • stops the containers started by test:docker:start
  • test:local
    • sets the necessary environment variables for the test
    • runs the tests

To keep review scope manageable, only work on one PR per package:

Additional task (documentation):

Once all packages have been updated:

  • document how to run local tests for a package in CONTRIBUTING.md. Since all scripts behave the same, it should be enough to mention the order of scripts to run.

Additional resources

@pichlermarc pichlermarc added type:feature-tracking A feature with sub-issues that need to be addressed needs:code-contribution This feature/bug is ready to implement labels Mar 25, 2024
@pichlermarc pichlermarc added the up-for-grabs Good for taking. Extra help will be provided by maintainers label Mar 25, 2024
@pikalovArtemN
Copy link
Contributor

Can i pick it ?

@pikalovArtemN
Copy link
Contributor

pikalovArtemN commented Apr 25, 2024

And what do you think about Testсontainers ?

@pichlermarc
Copy link
Member Author

@pikalovArtemN

thanks for volunteering. 🎉

And what do you think about Testсontainers ?

I've never used them directly so I'd have a few questions first:

  • do they work in GitHub Workflows?
    • from experience it's cumbersome to spin up containers in CI, and if we add it to the test code directly I'd like to go for a unified approach (able to run both in CI and locally using testcontainers, alinging local and CI testing as closely as possible)
  • Can image version updates be automated using renovate or similar?
    • Workflow files get automatically updated by renovate if needed, so when going for a unified approach it'd also be good if we could keep this
  • How does this affect Windows/macOS users that may not use Docker Desktop but an alternative such as Podman or Colima? Can they still run it? Is there more (or less) extra configuration required for them compared to the approach outlined above? 🤔

trentm added a commit to trentm/opentelemetry-js-contrib that referenced this issue May 16, 2024
…site services in Docker

tl;dr:
    npm run test-services:start     # starts services in Docker
    npm run test:with-test-services # runs 'npm test' with envvars from test/test-services.env
    npm run test-services:stop      # stops Docker containers

Closes: open-telemetry#2038
@trentm
Copy link
Contributor

trentm commented May 16, 2024

Hi. I have a proposal for this at #2214

@pikalovArtemN I hope I didn't stomp on something you were working on already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs:code-contribution This feature/bug is ready to implement type:feature-tracking A feature with sub-issues that need to be addressed up-for-grabs Good for taking. Extra help will be provided by maintainers
Projects
None yet
3 participants