Skip to content

test: ability to configure pgjdbc version and PostgreSQL dbname, user, and password for testing #44

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

Closed
wants to merge 1 commit into from
Closed
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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ Developer Information
$ sudo -u postgres createuser clojure_test -P clojure_test
$ sudo -u postgres createdb clojure_test -O clojure_test

You can use TEST_POSTGRES_DBNAME, TEST_POSTGRES_USER, TEST_POSTGRES_PASSWORD environment variables to set dbname, user, and password used for tests

* Or similarly with MySQL:

$ mysql -u root
Expand Down
6 changes: 5 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
<tag>HEAD</tag>
</scm>

<properties>
<java.jdbc.test.pgjdbc.version>9.4.1208.jre7</java.jdbc.test.pgjdbc.version>
</properties>

<build>
<plugins>
<plugin>
Expand Down Expand Up @@ -86,7 +90,7 @@
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.4.1208.jre7</version>
<version>${java.jdbc.test.pgjdbc.version}</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
9 changes: 6 additions & 3 deletions src/test/clojure/clojure/java/test_jdbc.clj
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@
;; PostgreSQL host/port
(def postgres-host (or (System/getenv "TEST_POSTGRES_HOST") "127.0.0.1"))
(def postgres-port (or (System/getenv "TEST_POSTGRES_PORT") "5432"))
(def postgres-dbname (or (System/getenv "TEST_POSTGRES_DBNAME") "clojure_test"))
(def postgres-user (or (System/getenv "TEST_POSTGRES_USER") "clojure_test"))
(def postgres-password (or (System/getenv "TEST_POSTGRES_PASSWORD") postgres-user))

;; database connections used for testing:

Expand All @@ -83,11 +86,11 @@
:dbname "clojure_test_sqlite"})

(def postgres-db {:dbtype "postgres"
:dbname "clojure_test"
:dbname postgres-dbname
:host postgres-host
:port postgres-port
:user "clojure_test"
:password "clojure_test"})
:user postgres-user
:password postgres-password})

(def mssql-db {:dbtype "mssql"
:dbname mssql-dbname
Expand Down