Skip to content
generated from dogmatiq/template-go

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

License

Notifications You must be signed in to change notification settings

dogmatiq/sqltest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

Resources

License

Stars

Watchers

Forks

Packages

No packages published