Developing SIPI¶
Using an IDE¶
CLion¶
If you are using the CLion IDE, note
that code introspection in the CLion editor may not work until it has
run CMake. Open the project root directory (which contains CMakeLists.txt)
and let CLion configure the project automatically.
For Nix-based development, launch CLion from inside the Nix shell so it inherits all required environment variables and dependencies:
Writing Tests¶
We use two test frameworks: GoogleTest for unit tests and pytest for end-to-end tests.
Unit Tests¶
Unit tests live in test/unit/ and use GoogleTest with ApprovalTests.
Tests are organized by component:
test/unit/configuration/- Configuration parsing teststest/unit/iiifparser/- IIIF URL parser teststest/unit/sipiimage/- Image processing teststest/unit/logger/- Logger teststest/unit/handlers/- HTTP handler tests
Run all unit tests:
Run a specific test binary directly:
End-to-End Tests¶
End-to-end tests live in test/e2e/ and use pytest. To add tests,
create a Python file whose name begins with test_ in the test/e2e/
directory. The test fixtures in test/e2e/conftest.py handle starting
and stopping a SIPI server and provide other testing utilities.
Run e2e tests:
Smoke Tests¶
Smoke tests live in test/smoke/ and run against a Docker image.
They verify basic server functionality after a Docker build:
Approval Tests¶
Approval tests live in test/approval/ and use snapshot-based
testing for regression detection.
Commit Message Schema¶
We use Conventional Commits:
type(scope): subject
body
Types:
feat- new feature (SemVer minor)fix- bug fix (SemVer patch)docs- documentation changesstyle- formatting, no code changerefactor- refactoring production codetest- adding or refactoring testsbuild- changes to build system or dependencieschore- miscellaneous maintenanceci- continuous integration changesperf- performance improvements
Breaking changes are indicated with !:
feat!: remove deprecated API endpoint
Example:
feat(HTTP server): support more authentication methods