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: 8 months 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 4 years ago)
- Default Branch: master
- Last Pushed: 2022-09-30T17:35:02.000Z (about 3 years ago)
- Last Synced: 2024-07-31T20:52:57.136Z (over 1 year 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
[](https://pkg.go.dev/github.com/arikama/go-mysql-test-container)
[](https://goreportcard.com/report/github.com/arikama/go-mysql-test-container)
[](https://codecov.io/gh/arikama/go-mysql-test-container)
[](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 main
import (
"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
```