Skip to content

test(learning): integration tests for the validation engine against real containers#60

Merged
Derssa merged 2 commits into
mainfrom
feat/learning-engine-integration-tests
Jul 15, 2026
Merged

test(learning): integration tests for the validation engine against real containers#60
Derssa merged 2 commits into
mainfrom
feat/learning-engine-integration-tests

Conversation

@OthmaneZ05

@OthmaneZ05 OthmaneZ05 commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Summary of Changes

Adds an integration test suite for the validation engine (backend/src/modules/learning/engine/engine.itest.ts). The unit tests next to each validator mock every Docker/DB call, so they prove the logic but never the contact with reality (container startup timing, DB readiness, real ASG label resolution). This suite stands up one disposable project with real Docker containers (Postgres/Redis/Mongo seeded with real data, a load balancer, a running auto-scaling group) and runs all 8 validators — pass and fail — through runStepValidators with its default (real) dependencies. Every pass/fail pair reads the same static fixture with different params, so nothing is mutated between assertions, keeping the suite non-flaky. It stays out of the default npm test run (existing *.itest.ts / jest.integration.config.js convention) and is wired into the existing dedicated Integration GitHub Actions job by extending its paths filters.

Types of Changes

  • New feature / node type addition
  • Bug fix (non-breaking change resolving an issue)
  • Refactoring / structural cleanup
  • Documentation update
  • Test coverage addition

Verification & Testing

Automated Checks

  • Run npm run lint successfully with no errors
  • Run npm run build successfully with no compilation errors
  • Run npm test successfully (all tests pass — 206/206, unchanged, no Docker dependency)

Manual Verification

Ran npm run test:integration locally against a real Docker daemon 3 times in a row: all 16 new assertions pass every time, no flaky result. Ran the full integration suite (both *.itest.ts files): 21/21. Confirmed no leftover containers after teardown (docker ps -a filtered on the test project's label).

Checklist

  • My code follows the repository's code style and lint standards
  • I have updated the documentation or instructions if necessary
  • All unit and integration tests are passing

…ontainers

Unit tests mock every Docker/DB call, so they prove validator logic but never
contact with reality (container timing, DB readiness, real ASG label
resolution). Adds engine.itest.ts: one disposable project with real
containers, run through runStepValidators' default (real) dependencies for
all 8 validators, pass and fail, from a single static fixture so nothing is
mutated between assertions.
@OthmaneZ05 OthmaneZ05 requested a review from Derssa as a code owner July 15, 2026 04:47
…tion tests

CI failed with "network akal-lab-network not found": createContainer attaches
every container to that network, but it's normally created once at server
startup (DockerInitializer.ensureSharedNetwork) and this suite never boots the
server, so a fresh Docker daemon doesn't have it yet.
@Derssa Derssa merged commit 6102a6b into main Jul 15, 2026
3 checks passed
@Derssa Derssa deleted the feat/learning-engine-integration-tests branch July 15, 2026 05:05
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