feat: validacao com testcontainers, build docker no ci e retencao de pacotes - #11
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8cab572262
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| prune-packages: | ||
| name: Prune Older Packages (Keep Last 3) | ||
| needs: build-and-push-docker |
There was a problem hiding this comment.
Keep package pruning out of the release workflow
Remove this duplicate retention job: .github/workflows/cleanup-packages.yml already listens for completion of Release and Docker Package and runs the same cleanup action with the same policy. Every successful release therefore performs deletion and registry validation twice, while a transient failure in this new job marks an otherwise successfully published release workflow as failed; if it fails, the existing retention workflow then skips its cleanup because it requires a successful release conclusion.
Useful? React with 👍 / 👎.
| try: | ||
| cls.imagem = obter_ou_construir_imagem(cls.imagem) | ||
| except Exception as e: | ||
| raise unittest.SkipTest(f"Falha ao obter ou construir imagem Docker: {e}") |
There was a problem hiding this comment.
Fail the test when image construction fails
When Docker is available but the requested image is absent, this helper attempts to build the Dockerfile; however, any build error is converted into SkipTest, so a local or standalone run of the new container suite reports success-with-skip for exactly the broken Dockerfile it is intended to validate. Only dependency or daemon unavailability should skip the suite—once docker_disponivel() has succeeded, failures from obter_ou_construir_imagem() should fail the test.
Useful? React with 👍 / 👎.
| # Sem banco montado e sem gateway externo, o healthz esperado é 503 DATABASE_NOT_READY | ||
| self.assertIn(status_healthz, (200, 503)) | ||
| self.assertEqual(cabecalho_server, "9RTKSync") | ||
| self.assertTrue( | ||
| "OK" in corpo_healthz or "DATABASE_NOT_READY" in corpo_healthz or "ROUTER_SERVICE_UNREACHABLE" in corpo_healthz, |
There was a problem hiding this comment.
Assert the deterministic default health response
The container started here has neither /app/data/db/data.sqlite nor a gateway running at its container-local 127.0.0.1, so, as the preceding comment states, the expected result is specifically 503 DATABASE_NOT_READY. Accepting 200 OK or ROUTER_SERVICE_UNREACHABLE allows regressions in the default DB_PATH wiring or database-readiness check to pass this image validation even though the container is reporting the wrong state.
Useful? React with 👍 / 👎.
Implementa a validacao da imagem Docker utilizando Testcontainers, adiciona a verificacao do build no GitHub Actions CI e garante a retencao das ultimas 3 versoes no GitHub Packages.