integration-testing initial phase#1
Open
Prajwal17Tunerlabs wants to merge 24 commits into
Open
Conversation
The CI pipeline was failing because the `test:integration` npm script invoked `mocha` which resolved to the globally installed mocha from the nvm environment (Node v24 global) rather than the local package in node_modules. The global mocha binary cannot resolve locally-installed packages like `mocha-junit-reporter`, causing the reporter load to fail. Fix by explicitly referencing `./node_modules/.bin/mocha` so the locally installed mocha is always used, ensuring it can find all local devDependencies including `mocha-junit-reporter`.
…r-resolution fix: use local mocha binary to resolve mocha-junit-reporter correctly
The recent refactor in commonTests.js changed USER_INTERNAL_ACCESS_TOKEN to read from process.env.INTERNAL_ACCESS_TOKEN (without a fallback default). However, the CI test step only exported ADMIN_SECRET_CODE from the user service .env file, leaving INTERNAL_ACCESS_TOKEN undefined during test runs. This caused admin user creation requests to fail authentication against the user-service, breaking the integration test suite. Fix: extract INTERNAL_ACCESS_TOKEN from ~/services/user/src/.env using the same pattern already used for ADMIN_SECRET_CODE.
…ss-token-ci fix: export INTERNAL_ACCESS_TOKEN to integration test environment
…tion tests The CI pipeline was using a fixed `sleep 60` delay before running integration tests, which was unreliable — services (user, entity, project, interface) could take longer to fully initialize, especially after DB migrations and Kafka startup, causing tests to run against unready services. The mocha-junit-reporter produces no stdout output, so when the before() hook in integration tests hangs (connection refused to user-service), the CI step either times out via no_output_timeout (5m) or exits with a non-zero code and no diagnostic output visible in the log. Fix: replace `sleep 60` with four `wait_for_http` health checks (one per application service) using the already-defined reusable command. Each check polls the /health endpoint up to 60 times with 3s intervals (180s max), failing fast with a clear error if a service does not become ready in time.
…-health-checks fix: replace sleep 60 with wait_for_http health checks before integration tests
Commits 4733067 and ee5a447 removed the wait_for_http steps that ensured all four application services (user, entity, project, interface) were fully HTTP-ready before the integration test suite ran. wait_for_port only confirms TCP connectivity — it does not guarantee the Node.js service has finished initialising (DB connections, Kafka, etc.). When tests start against a service that is listening on the port but not yet serving HTTP, the mocha before() hooks fail silently and mocha-junit-reporter produces no stdout, causing the CI step to appear empty or exit without useful diagnostics. Fix: re-add wait_for_http calls (polling /health up to 180 s each) for all four services, after the existing wait_for_port checks.
…for-http-health-checks fix: restore wait_for_http health checks before integration tests
The wait_for_http step for project-service polls /health without any query parameters, which causes the health check handler to run a full check including microservice dependency checks (user-service, entity-management, SamikshaService) via the interface-service. However, the interface-service has not yet been confirmed healthy at that point in the pipeline (it is checked in the next step), creating a race condition where project-service's /health returns a 400 error because it cannot reach the interface-service. Fix: append ?basicCheck=true to the project-service health check URL. The elevate-services-health-check library skips microservice dependency checks when basicCheck is truthy, so only MongoDB, Kafka, and Gotenberg are verified — all of which are already confirmed up before this step.
…ce-health-check-basic fix: use basicCheck=true for project-service CI health check
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
These recommendations are intended to promote code quality and team communication during software development. They cover a variety of topics, including ensuring that pull requests are submitted to the correct branch, documenting new methods, preserving consistency across many services, and avoiding typical blunders like accessing APIs or DB queries within loops. Sensitive data should not be uploaded, and changes to environment variables or database models should be executed consistently. Teams may work more effectively and develop higher-quality software by adhering to these standards.
Type of change
Please choose appropriate options.
Checklist