2.1 KiB
Development
This document explains how to develop Ory Keto, run tests, and work with the tooling around it.
Upgrading and changelog
New releases might introduce breaking changes. To help you identify and incorporate those changes, we document these changes in UPGRADE.md and CHANGELOG.md.
Command line documentation
To see available commands and flags, run:
keto -h
# or
keto help
Contribution guidelines
We encourage all contributions. Before opening a pull request, read the contribution guidelines.
Prerequisites
You need Go 1.19+ and, for the test suites:
- Docker and Docker Compose
- GNU Make 4.3
- Node.js and npm >= v7
It is possible to develop Ory Keto on Windows, but please be aware that all guides assume a Unix shell like bash or zsh.
Install from source
To install Keto from source:
make install
Formatting code
Format all code using:
make format
The continuous integration pipeline checks code formatting.
Running tests
There are two types of tests:
- Short tests that do not require a SQL database like PostgreSQL
- Regular tests that require PostgreSQL, MySQL, and CockroachDB
Short tests
Short tests run fairly quickly and use SQLite in-memory.
Run all short tests:
go test -short ./...
Run short tests in a specific module:
go test -short ./internal/check/...
Regular tests
Regular tests require a database setup.
The test suite can work with docker directly using ory/dockertest, but we encourage using the script instead. Using dockertest can bloat the number of Docker Images on your system and starting them on each run is quite slow.
Run the full test suite:
source ./scripts/test-resetdb.sh
go test ./...
End-to-end tests
The e2e tests are part of the normal go test. To only run the e2e test, use:
source ./scripts/test-resetdb.sh
go test ./internal/e2e/...
or add the -short tag to only test against sqlite in-memory.
Build Docker image
To build a development Docker image:
make docker