From 83c4dd31d9dfdf76784420dbf83a9b1057d0a262 Mon Sep 17 00:00:00 2001 From: Curtis Vogt Date: Wed, 6 Dec 2017 17:03:23 -0600 Subject: [PATCH] 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. --- .travis.yml | 9 +++++++++ test/mytest.odbc.ini | 1 + test/runtests.jl | 12 ++++++++---- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6962bbb..e7e1864 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,6 +18,14 @@ julia: - 0.6 - nightly +env: + - ODBC_DSN=MySQL-test + +matrix: + fast_finish: true + allow_failures: + - julia: nightly + services: - mysql - postgresql @@ -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 diff --git a/test/mytest.odbc.ini b/test/mytest.odbc.ini index d6f978d..6c34584 100644 --- a/test/mytest.odbc.ini +++ b/test/mytest.odbc.ini @@ -7,3 +7,4 @@ Database = mysql Server = localhost Port = 3306 Socket = +Option = 65536 \ No newline at end of file diff --git a/test/runtests.jl b/test/runtests.jl index c2e16f9..f488278 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -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", "") @@ -308,4 +312,4 @@ println("mysql passed.") # @test data.test_array[1] == "{1,2,3}" # showall(data) -# println("postgresql passed.") \ No newline at end of file +# println("postgresql passed.")