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

Conversation

vlsi
Copy link

@vlsi vlsi commented Sep 17, 2016

The idea is to simplify testing of java.jdbc against different pgjdbc versions

@vlsi
Copy link
Author

vlsi commented Sep 17, 2016

TEST_DBS=postgres TEST_POSTGRES_USER=test TEST_POSTGRES_DBNAME=test mvn test gives me something evil:

[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ java.jdbc ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ java.jdbc ---
[INFO]
[INFO] --- clojure-maven-plugin:1.3.13:test (clojure-test) @ java.jdbc ---

Testing clojure.java.test-utilities

Testing clojure.java.test-jdbc

FAIL in (test-metadata-managed) (test_jdbc.clj:770)
expected: (= "fruit" (-> table-info first :table_name clojure.string/lower-case))
  actual: (not (= "fruit" "evil.table"))

FAIL in (test-metadata-managed-computed) (test_jdbc.clj:778)
expected: (= "fruit" (sql/with-db-metadata [metadata db] (sql/metadata-query (.getTables metadata nil nil nil (into-array ["TABLE" "VIEW"])) {:row-fn (comp clojure.string/lower-case str :table_name), :result-set-fn first})))
  actual: (not (= "fruit" "evil.table"))

FAIL in (test-metadata) (test_jdbc.clj:796)
expected: (= "fruit" (-> table-info first :table_name clojure.string/lower-case))
  actual: (not (= "fruit" "evil.table"))

FAIL in (test-raw-metadata) (test_jdbc.clj:757)
expected: (= "fruit" (-> table-info first :table_name clojure.string/lower-case))
  actual: (not (= "fruit" "evil.table"))

Ran 70 tests containing 168 assertions.
4 failures, 0 errors.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE

Can you explain if that is my fault or the master branch just does not work at the moment?

PS. I've very little understanding of Clojure code.

@seancorfield
Copy link
Member

Hi Vladimir -- thank you for your interest in clojure.java.jdbc and the suggestion to make testing more tweakable with additional environment variables. The master branch works fine, as you can see from the CI build matrix here http://build.clojure.org/job/java.jdbc-test-matrix/ so I'm not entirely sure what's happening locally for you. I test clojure.java.jdbc locally with PostgreSQL (using a Docker container), as well as MySQL, Microsoft SQL Server (both the MS driver and jTDS driver), as well as Derby, SQLite, H2, and HSQLDB. I use Leiningen for testing locally, the CI system uses Maven. Try to use:

TEST_DBS=postgres TEST_POSTGRES_USER=test TEST_POSTGRES_DBNAME=test lein test

and see whether you get the same strange behavior.

The Clojure contrib projects don't accept Pull Requests. You can read about the contribution process here: http://clojure.org/community/contributing

Feel free to join the https://groups.google.com/forum/#!forum/clojure-java-jdbc Google Group for more discussions with other clojure.java.jdbc users. Maybe someone there can assist with PostgreSQL (I don't use it, aside from testing this library against it).

@seancorfield
Copy link
Member

I updated pom.xml and project.clj to use 9.4.1210 and re-ran all the tests to ensure things work. Note that the tests focus on SQL that is portable across all databases under test and therefore they do not test PostgreSQL-specific data types -- although the tests do check the extensibility via protocols a little.

@seancorfield
Copy link
Member

I opened a JIRA issue to look into changes that will make it easier to test clojure.java.jdbc in different environments: http://dev.clojure.org/jira/browse/JDBC-143

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants