From 4483f7638a8977d4fe4a9a4b0815f6661876b017 Mon Sep 17 00:00:00 2001 From: Ian Date: Mon, 22 Jul 2019 15:56:49 -0400 Subject: [PATCH 1/4] fix: restore additional tests --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index ba07732..fb5855c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -35,6 +35,7 @@ after_success: - julia -e 'import Pkg; Pkg.instantiate(); Pkg.add("Coverage"); using Coverage; Codecov.submit(Codecov.process_folder())' jobs: + include: - stage: tests os: osx julia: 1.1 From 1cc2ca6f8ba52f14992241fe7ff1032917d69efb Mon Sep 17 00:00:00 2001 From: Ian Date: Tue, 23 Jul 2019 16:18:58 -0400 Subject: [PATCH 2/4] fix: MySQL tests now work on MacOS Homebrew-configured versions of MySQL: 1. Only create a user with the same name as the current user (no root) 2. Don't allow that user to login using 127.0.0.1 (but works with "localhost") The tests have been modified to take this into consideration --- src/DBUtils/mysql_db_utils.jl | 4 ++-- test/dbutils_mysql.jl | 2 +- test/processes_mysql.jl | 6 +++--- test/pubmed.jl | 16 ++++++++-------- test/runtests.jl | 16 +++++++++++++++- 5 files changed, 29 insertions(+), 15 deletions(-) diff --git a/src/DBUtils/mysql_db_utils.jl b/src/DBUtils/mysql_db_utils.jl index 5dde4f1..97e2b28 100644 --- a/src/DBUtils/mysql_db_utils.jl +++ b/src/DBUtils/mysql_db_utils.jl @@ -21,11 +21,11 @@ Create a MySQL database using the code inside mysql_code """ function init_mysql_database(host="127.0.0.1", - user="root", pwd="", dbname="test"; overwrite=false, opts = Dict()) + user="root", pswd="", dbname="test"; overwrite=false, opts = Dict()) opts[MySQL.API.MYSQL_SET_CHARSET_NAME] = "utf8mb4" - con = MySQL.connect(host, user, pwd, opts=opts) + con = MySQL.connect(host, user, pswd, opts=opts) init_mysql_database(con, dbname, overwrite) end diff --git a/test/dbutils_mysql.jl b/test/dbutils_mysql.jl index ab81f54..55fcc33 100644 --- a/test/dbutils_mysql.jl +++ b/test/dbutils_mysql.jl @@ -5,7 +5,7 @@ using MySQL dbname="pubmed_test" - conn = DBUtils.init_mysql_database("127.0.0.1", "root", "", dbname) + conn = DBUtils.init_mysql_database(MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD, dbname) PubMed.create_tables!(conn) println(conn) diff --git a/test/processes_mysql.jl b/test/processes_mysql.jl index 9b5f744..a6bbe36 100644 --- a/test/processes_mysql.jl +++ b/test/processes_mysql.jl @@ -13,9 +13,9 @@ const verbose = false #************************ MYSQL ********************************************** -const host="127.0.0.1" #If want to hide - use enviroment variables instead -const mysql_usr="root" -const mysql_pswd="" +const host=MYSQL_HOST #If want to hide - use enviroment variables instead +const mysql_usr=MYSQL_USER +const mysql_pswd=MYSQL_PASSWORD const dbname="pubmed_processes_test" const dbname_pmid ="pmid_processes_test" const medline_file = 1 diff --git a/test/pubmed.jl b/test/pubmed.jl index e957013..484bd87 100644 --- a/test/pubmed.jl +++ b/test/pubmed.jl @@ -56,11 +56,11 @@ import Base.parse println("-----------------------------------------") println(" Test Save PMID MySQL ") dbname = "entrez_test" - host = "127.0.0.1"; - user = "root" - pwd = "" + host = MYSQL_HOST + user = MYSQL_USER + pswd = MYSQL_PASSWORD - conn = DBUtils.init_mysql_database(host, user, pwd, dbname) + conn = DBUtils.init_mysql_database(host, user, pswd, dbname) PubMed.create_pmid_table!(conn) PubMed.save_pmids!(conn, ids) @@ -78,11 +78,11 @@ import Base.parse println(" Testing MySQL Saving") dbname = "efetch_test" - host = "127.0.0.1"; - user = "root" - pwd = "" + host = MYSQL_HOST + user = MYSQL_USER + pswd = MYSQL_PASSWORD - conn = DBUtils.init_mysql_database(host, user, pwd, dbname) + conn = DBUtils.init_mysql_database(host, user, pswd, dbname) PubMed.create_tables!(conn) @time PubMed.save_efetch!(conn, efetch_doc, false, true) diff --git a/test/runtests.jl b/test/runtests.jl index 3d33a67..5745c5e 100755 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -17,7 +17,6 @@ using MySQL using SQLite using DataStreams - #For now this corresponds to JULIACIBot... since we aren't testing anywhere else global CI = get(ENV, "CI", "false")=="true" global TRAVIS = get(ENV, "TRAVIS", "false")=="true" @@ -39,6 +38,21 @@ all_tests = [ ("processes_df.jl", " Testing: Processes DataFrame") ] if !CI_SKIP_MYSQL + # on MacOS host name must be localhost + if Sys.isapple() + global const MYSQL_HOST = "localhost" + else + global const MYSQL_HOST = "127.0.0.1" + end + + if Sys.isapple() + global const MYSQL_USER = get(ENV, "MYSQL_USER", get(ENV, "LOGNAME", "root")) + else + global const MYSQL_USER = get(ENV, "MYSQL_USER", "root") + end + + global const MYSQL_PASSWORD = get(ENV, "MYSQL_PASSWORD", "") + push!(all_tests, ("dbutils_mysql.jl", " Testing: DBUtils MySQL")) push!(all_tests, ("processes_mysql.jl", " Testing: Processes MySQL")) end From 96e1a0f15c4abe39dfc9f6e88e5debedeada52fd Mon Sep 17 00:00:00 2001 From: Ian Date: Tue, 23 Jul 2019 16:21:03 -0400 Subject: [PATCH 3/4] fix: change group names --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index fb5855c..bc627ad 100644 --- a/.travis.yml +++ b/.travis.yml @@ -36,14 +36,14 @@ after_success: jobs: include: - - stage: tests + - stage: test os: osx julia: 1.1 env: GROUP=Test script: - julia -e 'import Pkg; Pkg.build(); Pkg.test(coverage=false);' after_success: skip - - stage: examples + - stage: example os: linux julia: 1.1 env: GROUP=Examples From 07e5aa64f9d6fd306bb0f0371fad930b191c0d55 Mon Sep 17 00:00:00 2001 From: Ian Date: Wed, 24 Jul 2019 09:57:37 -0400 Subject: [PATCH 4/4] fix: use Travis' package management tools --- .travis.yml | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index bc627ad..c4d38d5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,15 +22,13 @@ notifications: sudo: false addons: - mariadb: '10.4' - -script: - - if [ "$TRAVIS_OS_NAME" == "osx" ]; then . ./ci/travis/before_install-osx.sh; fi - - export OLD_PATH=$LD_LIBRARY_PATH - - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`mariadb_config --libs | cut -d ' ' -f1 | sed 's/-L//'` -after_script: - - export LD_LIBRARY_PATH=$OLD_PATH - - unset OLD_PATH + apt: + packages: + - mariadb-server + homebrew: + packages: + - mariadb + after_success: - julia -e 'import Pkg; Pkg.instantiate(); Pkg.add("Coverage"); using Coverage; Codecov.submit(Codecov.process_folder())' @@ -39,14 +37,12 @@ jobs: - stage: test os: osx julia: 1.1 - env: GROUP=Test script: - julia -e 'import Pkg; Pkg.build(); Pkg.test(coverage=false);' after_success: skip - stage: example os: linux julia: 1.1 - env: GROUP=Examples script: - julia -e 'import Pkg; Pkg.instantiate(); include(joinpath(@__DIR__, "examples", "runexamples.jl"))' - stage: deploy documentation