Hello, I sent PR #9 for following issue. Please consider this PR.
The problem is, After SQL style database creation and dropping was implemented, and accordingly mysql.urlWithoutDb()
was added, the method just returns auto-generated URL with user
, pass
, host
, and port
. In case of user specifiy connection information as URL, with options, it was ignored and hard coded default options are provided by the method.
In some condition, the default read timeout option (readTimeout=1s
) is not enough and it makes operation failure. For example, when dropping existing database, and truncate all data for running test.
In my cases, I met following errors when I run my test cases on travis-ci:
[mysql] 2018/03/02 21:03:11 packets.go:33: read tcp 127.0.0.1:49306->127.0.0.1:3306: i/o timeout
[mysql] 2018/03/02 21:03:12 packets.go:33: read tcp 127.0.0.1:49308->127.0.0.1:3306: i/o timeout
[mysql] 2018/03/02 21:03:13 packets.go:33: read tcp 127.0.0.1:49496->127.0.0.1:3306: i/o timeout
and
--- FAIL: Test_ActionSuite (87.60s)
--- FAIL: Test_ActionSuite/Test_RolesResource_A_Protected (3.00s)
Error Trace: model.go:20
suite.go:47
suite.go:88
Error: Received unexpected error:
driver: bad connection
<...>/gobuffalo/pop.(*Connection).timeFunc
<...>/gobuffalo/pop.(*Query).Exec
<...>/gobuffalo/pop.(*mysql).TruncateAll
mainly for TruncateAll, as see above.
After facing the issue, I tested it on my poor laptop, with limited resources, and I met another errors while just dropping the database:
$ buffalo db drop -e test
v4.0.6
[mysql] 2018/03/05 16:16:01 packets.go:36: read tcp 127.0.0.1:37106->127.0.0.1:3306: i/o timeout
<...>
Not for every running, but sometimes.
Anyway, I checked with the codes (from pop to database/sql because I cannot figure out the reason) and I found and fixed the method.
(Sorry for long history but I think it will help some others using mysql
.)