Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pick up server config from .ini file in tests #61

Merged
merged 2 commits into from
Sep 15, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions REQUIRE
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ julia 0.4
DataFrames
Compat 0.7.20
Dates
ConfParser
10 changes: 7 additions & 3 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
using MySQL
using Base.Test
using ConfParser

# Change the below values to whatever it is on your test setup.
const HOST = "127.0.0.1"
const ROOTPASS = "" # In Travis CI the root password is an empty string.
conf = ConfParse("server.ini")
parse_conf!(conf)

const HOST = retrieve(conf, "default", "host") |> parse
const USER = retrieve(conf, "default", "user") |> parse
const PASS = retrieve(conf, "default", "pass") |> parse

for file in ["test_basic.jl", "test_prep.jl", "test_multiquery.jl"]
include(file)
Expand Down
6 changes: 6 additions & 0 deletions test/server.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
;; If a non-root user is provided below, then that user should
;; have database creation and user creation privilege.
[default]
host="127.0.0.1"
user="root"
pass="" ; In Travis CI the root password is an empty string.
2 changes: 1 addition & 1 deletion test/test_common.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function run_query_helper(command, msg)
end

function connect_as_root()
global hndl = mysql_connect(HOST, "root", ROOTPASS, "")
global hndl = mysql_connect(HOST, USER, PASS, "")
end

function create_test_database()
Expand Down