https://github.com/soh335/test-mysqld-docker
testing with docker mysqld for golang
https://github.com/soh335/test-mysqld-docker
docker golang mysql testing
Last synced: 2 months ago
JSON representation
testing with docker mysqld for golang
- Host: GitHub
- URL: https://github.com/soh335/test-mysqld-docker
- Owner: soh335
- License: mit
- Created: 2016-12-01T08:00:46.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-05-07T12:26:27.000Z (about 9 years ago)
- Last Synced: 2025-04-12T13:14:54.182Z (about 1 year ago)
- Topics: docker, golang, mysql, testing
- Language: Go
- Size: 11.7 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

# test-mysqld-docker
Testing with docker mysqld for golang. Support inside and outside of docker container.
## DOWNLOAD
```
$ go get github.com/soh335/test-mysqld-docker
```
## USAGE
```go
mysqld, err := mysqltest.NewMysqld(nil)
if err != nil {
log.Fatal(err.Error())
}
db, err := sql.Open("mysql", mysqld.DSN())
if err != nil {
log.Fatal(err.Error())
}
if err := db.Ping(); err != nil {
log.Fatal("ping failed")
}
```
### INSIDE DOCKER CONTAINER
Require docker command for finding parent conatiner network and ip address of mysql container is created. If you can allow to mount parent docker socket, add -v option like this ( ```-v /var/run/docker.sock:/var/run/docker.sock```).
## SEE ALSO
* https://github.com/lestrrat/go-test-mysqld
* https://github.com/punytan/p5-Test-Docker-MySQL
## LICENSE
* MIT