Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/arikama/go-mysql-test-container
Golang MySQL testcontainer package
https://github.com/arikama/go-mysql-test-container
docker mysql testcontainer
Last synced: 12 days ago
JSON representation
Golang MySQL testcontainer package
- Host: GitHub
- URL: https://github.com/arikama/go-mysql-test-container
- Owner: arikama
- License: mit
- Created: 2021-11-04T02:04:49.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2022-09-30T17:35:02.000Z (over 2 years ago)
- Last Synced: 2024-07-31T20:52:57.136Z (6 months ago)
- Topics: docker, mysql, testcontainer
- Language: Go
- Homepage:
- Size: 65.4 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-go - go-mysql-test-container - Golang MySQL testcontainer to help with MySQL integration testing. (Testing / Testing Frameworks)
- zero-alloc-awesome-go - go-mysql-test-container - Golang MySQL testcontainer to help with MySQL integration testing. (Testing / HTTP Clients)
- awesome-go-extra - go-mysql-test-container - 11-04T02:04:49Z|2022-06-08T15:28:41Z| (Testing / Testing Frameworks)
README
# go-mysql-test-container
[![pkg](https://pkg.go.dev/badge/github.com/arikama/go-mysql-test-container.svg)](https://pkg.go.dev/github.com/arikama/go-mysql-test-container)
[![report](https://goreportcard.com/badge/github.com/arikama/go-mysql-test-container)](https://goreportcard.com/report/github.com/arikama/go-mysql-test-container)
[![coverage](https://codecov.io/gh/arikama/go-mysql-test-container/branch/master/graph/badge.svg?token=isZCzDyj1N)](https://codecov.io/gh/arikama/go-mysql-test-container)
[![build](https://github.com/arikama/go-mysql-test-container/actions/workflows/build.yml/badge.svg)](https://github.com/arikama/go-mysql-test-container/actions/workflows/build.yml)Golang MySQL testcontainer that makes integration testing MySQL a breeze
## Usage
Execute
```
go get github.com/arikama/go-mysql-test-container
```Code
```go
package mainimport (
"testing""github.com/arikama/go-mysql-test-container/mysqltestcontainer"
)func Test(t *testing.T) {
mySql, _ := mysqltestcontainer.Create("test")
db := mySql.GetDb()
err := db.Ping()
if err != nil {
log.L.Errorln(err.Error())
}
}
```## Development
1. Make sure Docker is installed on your local machine
```
docker --version
```2. Make sure you can run Docker locally
```
docker run hello-world
```3. Run the test
```
./gotest.sh
```