Skip to content

Commit 83c4dd3

Browse files
omusquinnj
authored andcommitted
Fix tests on Travis CI (#177)
* Fix tests on Travis CI * Enable local-infile for the ODBC client Due to security restrictions in MySQL the [LOAD DATA LOCAL](https://dev.mysql.com/doc/refman/5.7/en/load-data-local.html) statement will only work if it is enabled on both the server and the client. To check if the settings is enabled on the server you can run: SHOW GLOBAL VARIABLES LIKE 'local_infile'; To enable the setting on the client for ODBC we need to have the ODBC DSN use the ["my.cnf"](https://dev.mysql.com/doc/refman/5.7/en/option-files.html) files via the ["Option" parameter](https://dev.mysql.com/doc/connector-odbc/en/connector-odbc-configuration-connection-parameters.html#codbc-dsn-option-flags) being set to 65536 ("USE_MYCNF"). * Allow failures on Julia nightly Note: Travis requires "env" to be defined before the allow_failures for things to work correctly.
1 parent b09e316 commit 83c4dd3

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

.travis.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@ julia:
1818
- 0.6
1919
- nightly
2020

21+
env:
22+
- ODBC_DSN=MySQL-test
23+
24+
matrix:
25+
fast_finish: true
26+
allow_failures:
27+
- julia: nightly
28+
2129
services:
2230
- mysql
2331
- postgresql
@@ -26,6 +34,7 @@ before_install:
2634
- cp ./test/.odbcinst.ini $HOME
2735
- odbcinst -i -s -h -f ./test/mytest.odbc.ini
2836
- odbcinst -i -s -h -f ./test/pgtest.odbc.ini
37+
- echo -e "\n[odbc]\nlocal-infile=1\n" >> $HOME/.my.cnf
2938

3039
notifications:
3140
email: false

test/mytest.odbc.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ Database = mysql
77
Server = localhost
88
Port = 3306
99
Socket =
10+
Option = 65536

test/runtests.jl

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,13 @@ using Base.Test, ODBC, DataStreams, Missings, WeakRefStrings, DataFrames, DecFP
99

1010
run(`uname -a`)
1111

12-
props = open(f->Dict(split(ln, ':') for ln in eachline(f)) , "/Users/jacobquinn/.tug/application.properties")
13-
RIG, server, port = map(strip, split(props["environment.subdomain"], '.'))[1], strip(props["routing.services.mysql.host"]), strip(props["routing.services.mysql.port"])
14-
dsn = ODBC.DSN("Driver={MySQL ODBC Driver}; user=domo; password=popchart; server=$server; port=$port;")
12+
dsn = if haskey(ENV, "ODBC_DSN")
13+
ODBC.DSN(ENV["ODBC_DSN"])
14+
else
15+
props = open(f->Dict(split(ln, ':') for ln in eachline(f)) , "/Users/jacobquinn/.tug/application.properties")
16+
RIG, server, port = map(strip, split(props["environment.subdomain"], '.'))[1], strip(props["routing.services.mysql.host"]), strip(props["routing.services.mysql.port"])
17+
ODBC.DSN("Driver={MySQL ODBC Driver}; user=domo; password=popchart; server=$server; port=$port;")
18+
end
1519

1620
# dsn = ODBC.DSN("Driver=MySQL;uid=root")
1721
# dsn = ODBC.DSN("MySQL-test", "root", "")
@@ -308,4 +312,4 @@ println("mysql passed.")
308312
# @test data.test_array[1] == "{1,2,3}"
309313
# showall(data)
310314

311-
# println("postgresql passed.")
315+
# println("postgresql passed.")

0 commit comments

Comments
 (0)