Skip to content

Testing

Orinuno has four test suites. Most of the time you will only need the unit suite, which has no external dependencies. The other three require either a valid Kodik token, Docker for Testcontainers, or both.

No Kodik token, no database, no network.

Terminal window
mvn test

What they cover:

  • KodikVideoDecoderServiceTest — ROT cipher across shifts, Base64 decode, full decode pipeline.
  • ParserServiceTest — parsing and persistence logic.
  • ContentControllerTest — REST controller through WebTestClient.bindToController.
  • ExportDataServiceTest — structured export DTO assembly.
  • ProxyProviderServiceTest — round-robin rotation.
  • OpenSourceGuardTest — asserts there are no imports from private projects. Keeps the standalone boundary clean.

Phase2EndToEndIT boots the full Spring context against a Testcontainers MySQL 8 container and exercises the parse-request log + export-ready flow end-to-end (HTTP → MyBatis → MySQL → scheduled RequestWorker → HTTP). Only the outermost ParserService.searchInternal boundary is mocked, so no Kodik token or network access is required.

Terminal window
mvn test -Pe2e -Dtest=Phase2EndToEndIT

Default mvn test skips it via excludedGroups=e2e so the unit suite stays fast (≈4s). The e2e run takes ~12s on a warm MySQL image.

What it covers:

  • POST /api/v1/parse/requestsRequestWorker.tick() claims via SELECT … FOR UPDATE SKIP LOCKEDmarkDone writes result_content_idsGET /parse/requests/{id} reports DONE.
  • Idempotent re-submit returns the same id (canonical-JSON SHA-256).
  • GET /api/v1/export/ready returns the seeded content with the Phase 2 metadata fields (lastSeason, lastEpisode, episodesCount) and the nested seasons/episodes/variants tree.
  • GET /parse/requests?limit=0 exposes X-Total-Count (the contract parser-kodik’s discovery loop reads for backpressure).

Uses a real Kodik token and a Testcontainers MySQL.

Terminal window
KODIK_TOKEN=your_token mvn test -Dtest=KodikLiveIntegrationTest

Runs a full end-to-end cycle: search → save → list → decode → export.

37 assertions against the real Kodik API. Validates response shapes and detects schema drift in CI. Does not need a database — pure HTTP.

Terminal window
KODIK_TOKEN=your_token mvn test -Dtest=KodikApiStabilityTest

Coverage per endpoint:

EndpointTestsWhat is validated
/search18title (ru/en/ja), shikimori_id, kinopoisk_id, imdb_id, types, with_seasons, translation_type, camrip, year, strict, not_blocked_in, genres, limit=1, nonexistent, invalid token
/search + material_data3Ratings, numeric vs list fields, film (Matrix)
/list8sort × order combos, types, pagination, with_material_data, year, subtitles
/translations/v23Structure, known voices (AniLibria), type (voice/subtitles)
/genres3Structure, genre presence, genres_type filter
/countries2Structure, country presence
/years2Structure, year presence (2023/2024)
/qualities/v22Structure, quality presence

Each test includes schema drift detection: response keys are compared against the known DTO field set. Unknown keys are logged as [SCHEMA DRIFT] in stderr but do not fail the test. A missing required field (id, link, translation) fails the test loud.

Terminal window
KODIK_TOKEN=your_token mvn test -Dtest="KodikApiStabilityTest,KodikLiveIntegrationTest"
Terminal window
mvn test -Dtest='!KodikApiStabilityTest,!KodikLiveIntegrationTest,!VideoDownloadLiveIntegrationTest'