Repository navigation
Development and Testing
KingresDB does not use GitHub Actions: Actions is off for the repository, and no workflow is published. Every check runs on a developer's machine, and the maintainers check pull requests locally. This is a decision of the project owner. The packaging README says the same for its artifact tests.
From testing.md:
- Every phase deliverable includes tests; a phase is not finished while its features have no tests.
- A bug fix starts with a test that fails without the fix.
- Tests do not depend on the developer's machine: no fixed ports, no fixed paths outside the test's temporary directory, no network except to servers the test starts.
- A flaky test is a bug. Fix it or remove it; do not retry until it passes. (A TAP file that fails is rerun alone before it is called a real failure, because the timing-dependent tests of
kingres_shardcan fail on a loaded machine; a failure that repeats is a defect.)
The strategy behind the layers is on Testing Strategy.
| Layer | Tool | Where |
|---|---|---|
| Extension, single server (SQL interface, error codes, GUCs, upgrade) | pg_regress |
contrib/kingres_*/sql/ and expected/
|
| Extension, processes and WAL (crash recovery, standbys, background workers) | PostgreSQL TAP tests | contrib/kingres_*/t/ |
| Multi-node (routing, 2PC recovery, bucket moves, failover) | TAP tests that start several clusters | contrib/kingres_shard/t/ |
| Ledger | pg_regress and TAP; Go tests of the verifier | extension and kingres/verifier/
|
| Control plane, unit | go test |
*_test.go next to the code |
| Control plane, integration |
go test against real instances, three-kingresd cluster tests |
kingres/control-plane/ |
| API contract |
npm run check in kingres/api; contract tests on both sides |
kingres/api, kingres/control-plane, kingres/web
|
| Web | Vitest, a real-browser suite, an end-to-end run | kingres/web |
| Packaging | Debian package (test-deb.sh), image (test-image.sh), three-node compose cluster (test-compose.sh), the verifier package and the release script (test-verifier-package.sh, test-release.sh); the package and image tests run once per major |
kingres/packaging/test/ |
For C code run the tests on a build with assertions enabled; build.sh configures one. Every extension has a test that loads another module using the same hook, and an upgrade test from the oldest supported version.
See Building from Source. In short:
kingres/dev/build.sh all # server: build, install, core regression suite
kingres/dev/build.sh sync build test-all # every suite, including TAP
kingres/dev/ext.sh kingres_shard all # one extension against one installation
KINGRES_PG18=<install> KINGRES_PG19=<install> kingres/dev/ext-majors.sh kingres_shard
A change to an extension is complete only when ext-majors.sh passes on both majors, with warnings as errors.
From kingres/control-plane:
go vet ./...
gofmt -l . # must print nothing
golangci-lint run ./...
go test ./... # unit tests; integration tests skip without a database
CGO_ENABLED=1 go test -race ./... # needs a C compiler on PATH
Integration tests run against real PostgreSQL instances when KINGRES_PG_BIN is set. On Windows, scripts/run-integration.ps1 builds the test binaries for Linux, copies them into WSL2 and runs them there with scripts/run-wsl-tests.sh against a private installation. Its parameters include -Packages (one or several packages), -Run (a test name pattern), -Race, -Count (repeat the selected tests), -Install (an installation of another major, so the same suite runs on 18 and 19) and -Lane (runs of one lane queue behind each other; runs of different lanes run side by side, each with its own staging area and installation). KINGRES_TEST_KEEP=1 keeps the directories of a run for a post-mortem. After openapi.yaml changes, regenerate the operation table with go generate ./internal/contract; a test fails while it is stale.
From kingres/verifier: go test ./... (needs no database; the fixtures are checked in). There are scripts for generating fixtures (scripts/gen-fixtures.sh), for fuzzing (scripts/fuzz.sh), for checking that two builds of the release files are byte for byte the same (scripts/repro-check.sh) and for making the signed release (scripts/release.sh, see Release Process).
From kingres/api: npm run check (the contract checks) and npm run lint.
From kingres/web:
npm run typecheck
npm run lint # ESLint and prettier --check
npm test # Vitest, also checks that generated API files and brand files are current
npm run test:browser # layout, keyboard, axe and the CSP, in a real Chrome or Edge
npm run e2e # needs Windows with WSL2, Go and Chrome or Edge; run it when the machine is free
New C code is formatted with the tree's pgindent, using src/tools/pgindent/typedefs.list; the code should look like PostgreSQL C code. Every GUC carries the extension's prefix, and every error has a specific SQLSTATE and a test that asserts it. The rules per language are in coding-standards.md.
A change is done when: it has tests at the right layer and the relevant suites pass locally; the formatters and linters pass; the documentation is updated; any change to an upstream file has a row in the core-patches register; and a dated entry in the work log records what was done, how it was verified and what is still open.
Independent reviews, one-line mutants, fuzzing of the verifier and comparison of generated statements with a single node are part of how the project is checked, not of a pipeline. They are described on Review Process and Testing Strategy; the reports are in kingres/docs/reviews. The state of the reviews is on Status and Roadmap and Limitations and Known Issues.
- The control plane's integration script takes a system-wide Windows mutex per lane, so runs of the same lane by several people on one machine queue behind each other (Testing Strategy); give each lane its own installation (
-Install) when the extensions differ. - Each test run uses its own private copy of a PostgreSQL installation, because
ext.shinstalls extensions into the installation it is given.
Repository Layout (where code goes), Coding Standards, Branching and Synchronisation, Release Process, Contributing.
- kingres/docs/dev/testing.md
- kingres/docs/dev/coding-standards.md
- kingres/docs/dev/documentation.md
- kingres/docs/dev/core-patches.md
- kingres/control-plane/README.md
- kingres/web/README.md
- kingres/verifier/README.md
- kingres/api/README.md
- kingres/packaging/README.md
- kingres/dev/ext-majors.sh
- kingres/docs/worklog.md
- kingres/control-plane/scripts/run-integration.ps1
- kingres/verifier/scripts/fuzz.sh
KingresDB's own code is licensed under AGPL-3.0-only. PostgreSQL code keeps the PostgreSQL License. Copyright of the project's own code: RooyeKhat Media Co. KingresDB is derived from PostgreSQL and is not endorsed by the PostgreSQL project. Repository | Licence | COPYRIGHT
KingresDB
1. Product
- Product Overview and Features
- Status and Roadmap
- User Guide
- Administrator Guide
- REST API Reference
- Web Console
- Command Line Client
- Extensions
- Limitations and Known Issues
- Release Notes
Features in detail
- Sharding
- Sharding Query Pushdown
- Sharding Table Lifecycle
- High Availability
- Ledger
- Ledger Signing and Publication
- Ledger Anchoring
- The Verifier
- Analytics Extensions
Administration
- Cluster Setup
- Servers Databases and Roles
- Rebalancing
- Configuration
- Memory and Warm-up
- Control Plane and REST API
- Upgrades
2. Architecture (arc42)
- Architecture
- Architecture Introduction and Goals
- Architecture Constraints
- Architecture System Context
- Architecture Containers
- Architecture Components
- Architecture Runtime Views Sharding
- Architecture Runtime Views Availability and Ledger
- Architecture Deployment
- Architecture Crosscutting Concepts
- Security Model
- Architecture Decisions
- Architecture Quality Requirements
- Architecture Risks and Technical Debt
- Enterprise Architecture
3. Data architecture
- Data Architecture
- Data Model Sharding
- Data Model Ledger
- Data Model System Database
- Data Model Analytics
- Data Lifecycle
- Backup Restore and PITR
- Data Security
- Data Quality and Integrity
4. Development
- Building from Source
- Development and Testing
- Repository Layout
- Coding Standards
- Branching and Synchronisation
- Testing Strategy
- Review Process
- Release Process
- Contributing
5. Operations