Skip to content

Commit

Permalink
Fix tests on Travis CI (#177)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
omus authored and quinnj committed Dec 6, 2017
1 parent b09e316 commit 83c4dd3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
9 changes: 9 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ julia:
- 0.6
- nightly

env:
- ODBC_DSN=MySQL-test

matrix:
fast_finish: true
allow_failures:
- julia: nightly

services:
- mysql
- postgresql
Expand All @@ -26,6 +34,7 @@ before_install:
- cp ./test/.odbcinst.ini $HOME
- odbcinst -i -s -h -f ./test/mytest.odbc.ini
- odbcinst -i -s -h -f ./test/pgtest.odbc.ini
- echo -e "\n[odbc]\nlocal-infile=1\n" >> $HOME/.my.cnf

notifications:
email: false
Expand Down
1 change: 1 addition & 0 deletions test/mytest.odbc.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ Database = mysql
Server = localhost
Port = 3306
Socket =
Option = 65536
12 changes: 8 additions & 4 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@ using Base.Test, ODBC, DataStreams, Missings, WeakRefStrings, DataFrames, DecFP

run(`uname -a`)

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

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

# println("postgresql passed.")
# println("postgresql passed.")

0 comments on commit 83c4dd3

Please sign in to comment.