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

Do not start the container manually during tests action #940

Merged

Conversation

sambarza
Copy link
Contributor

Description

We start the container just to run the tests however the launched instance is not used by the tests, FastAPI's TestClient doesn't need the Cat to be running; it starts the Cat instance on its own for each individual test.
Removed the up and down steps.

This should also speed up the tests step too.

Using docker exec instead of docker run because exec needs an already running container, while run creates the container before starting the command. docker run need the service name instead of the container name.

Not related to issue.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • [X ] I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas

…because FastAPI's TestClient doesn't need the Cat to be running; it starts the Cat instance on its own for each individual test. It's not necessary to start the Cat manually beforehand.

This should also speed up the tests step.

Using `docker exec` instead of `docker run` because `exec` needs an already running container, while `run` creates the container before starting the command
@pieroit
Copy link
Member

pieroit commented Oct 10, 2024

Awesome, also for climate change :D

@pieroit pieroit merged commit 0534ab4 into cheshire-cat-ai:develop Nov 1, 2024
2 checks passed
@pieroit
Copy link
Member

pieroit commented Nov 1, 2024

You are right there is no need to launch again for the tests.
Also tried this out locally, works with and without the dev instance on.

Just added a --rm flag to remove the ocntainer once the tests are done:

docker compose run --rm cheshire-cat-core python -m pytest --color=yes .

Also just updated the docs to use your command

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

Successfully merging this pull request may close these issues.

2 participants