dogmatiq / sqltest

🚧 Internal utilities for testing Dogma projects that use SQL databases.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SQL Testing Utilities

A Go library containing utilities that help when writing tests that use real SQL database servers.

Documentation Latest Version Build Status Code Coverage

This library is only intended for use as a test dependencies for projects within the Dogmatiq organization.

The primary feature is the NewDatabase() function which creates a temporary database that can be discarded at the end of each test.

Database Products

The database products in the table below are currently supported. Some products are supported via multiple different Go SQL drivers.

Product Supported Drivers Notes
MySQL mysql β€”
MariaDB mysql β€”
PostgreSQL pgx (preferred), postgres β€”
SQLite sqlite3 Embedded database, requires CGO

Docker Stack

The docker-stack.yml file in this repository starts services for each of the supported database products. These services are typically required to run the tests for any project that depends on dogmatiq/sqltest.

The stack can be deployed using the following command:

curl https://raw.githubusercontent.com/dogmatiq/sqltest/main/docker-stack.yml | docker stack deploy dogmatiq-sqltest --compose-file -

GitHub Actions Configuration

Projects that depend on dogmatiq/sqltest should use the go+sql workflow. This workflow starts services for each of the supported database products, and runs the tests both with and without CGO enabled.

The workflow is chosen by changing the repository definition in the Terraform configuration. To see an example, check the definition of dogmatiq/sqltest itself, which uses this workflow.

About

🚧 Internal utilities for testing Dogma projects that use SQL databases.

License:MIT License


Languages

Language:Go 99.4%Language:Makefile 0.6%