From cd1156b6c0d071badad88ff0e6fcd7b9219347b8 Mon Sep 17 00:00:00 2001 From: Priyatam Mudivarti Date: Tue, 7 Jan 2020 21:08:40 -0800 Subject: [PATCH] fix tests, add docker guide --- README.md | 24 ++++++++++++++++++++++++ src/pregres/db.clj | 2 +- test/pregres_test.clj | 4 ---- 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 27a6e8c..bb5d3de 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,30 @@ simply shine with idiomatic Clojure. - Plain old SQL using [HugSQL](https://www.hugsql.org/) - Integration with popular Postgres extensions (postgis) +## Setup + +Install Postgres Docker + + docker pull postgres + +Create Local volume (optional) + + mkdir $HOME/.docker/volumes/postgres + +Run Postgres with username 'postgres', password 'docker' + + docker run --name postgres -e POSTGRES_PASSWORD=docker -d -p 5432:5432 -v $HOME/.docker/volumes/postgres:/var/lib/postgresql/data postgres + +Start Psql + + docker exec -it postgres bash + root@somehost100> psql -U postgres + +Run Tests + + lein test + + ## Credits Some functions are copied from the following libraries. I remain thankful to them. diff --git a/src/pregres/db.clj b/src/pregres/db.clj index 3f35329..3c1905c 100644 --- a/src/pregres/db.clj +++ b/src/pregres/db.clj @@ -20,7 +20,7 @@ pool." [& db-spec] (let [db-uri (java.net.URI. (or (:database-url db-spec) - (str "postgresql://localhost:5432/postgres"))) + (str "postgresql://postgres:docker@localhost:5432/postgres"))) user-and-password (if (nil? (.getUserInfo db-uri)) nil (str/split (.getUserInfo db-uri) #":")) pooled-ds (hikari/make-datasource diff --git a/test/pregres_test.clj b/test/pregres_test.clj index 2a6d3e1..9c2dba3 100644 --- a/test/pregres_test.clj +++ b/test/pregres_test.clj @@ -7,7 +7,3 @@ (use-fixtures :once fixtures/db) (def db-spec {:database-url "postgresql://localhost:5432/"}) - -(deftest components - (testing "starting, components" - (new-Database db-spec)))