Browse Source

Merge pull request #107 from seriyps/rebar3_tests

Make unit tests work with both rebar and rebar3
Sergey Prokhorov 8 years ago
parent
commit
7dee91a50e

+ 1 - 1
Makefile

@@ -17,7 +17,7 @@ src/epgsql_errcodes.erl:
 create_testdbs:
 	# Uses the test environment set up with setup_test_db.sh
 	echo "CREATE DATABASE ${USER};" | psql -h 127.0.0.1 -p 10432 template1
-	psql -h 127.0.0.1 -p 10432 template1 < ./test_data/test_schema.sql
+	psql -h 127.0.0.1 -p 10432 template1 < ./test/data/test_schema.sql
 	psql -h 127.0.0.1 -p 10432 epgsql_test_db1 -c "INSERT INTO schema_version (version) VALUES ('${LASTVERSION}');"
 
 test: compile

+ 4 - 4
setup_test_db.sh

@@ -18,10 +18,10 @@ max_replication_slots = 15
 max_wal_senders = 15
 EOF
 
-cp test_data/epgsql.crt datadir/server.crt
-cp test_data/epgsql.key datadir/server.key
-cp test_data/root.crt datadir/root.crt
-cp test_data/root.key datadir/root.key
+cp test/data/epgsql.crt datadir/server.crt
+cp test/data/epgsql.key datadir/server.key
+cp test/data/root.crt datadir/root.crt
+cp test/data/root.key datadir/root.key
 chmod 0600 datadir/server.key
 
 cat > datadir/pg_hba.conf <<EOF

+ 0 - 0
test_data/epgsql.crt → test/data/epgsql.crt


+ 0 - 0
test_data/epgsql.key → test/data/epgsql.key


+ 0 - 0
test_data/reset.sql → test/data/reset.sql


+ 0 - 0
test_data/root.crt → test/data/root.crt


+ 0 - 0
test_data/root.key → test/data/root.key


+ 0 - 0
test_data/test_schema.sql → test/data/test_schema.sql


+ 1 - 1
test/epgsql_tests.erl

@@ -89,7 +89,7 @@ connect_with_ssl_test(Module) ->
 
 connect_with_client_cert_test(Module) ->
     lists:foreach(fun application:start/1, ?ssl_apps),
-    Dir = filename:join(filename:dirname(code:which(epgsql_tests)), "../test_data"),
+    Dir = filename:join(code:lib_dir(epgsql), "test/data"),
     File = fun(Name) -> filename:join(Dir, Name) end,
     {ok, Pem} = file:read_file(File("epgsql.crt")),
     [{'Certificate', Der, not_encrypted}] = public_key:pem_decode(Pem),