Skip to content

Commit

Permalink
fix tests, add docker guide
Browse files Browse the repository at this point in the history
  • Loading branch information
priyatam committed Jan 8, 2020
1 parent 8f5c02f commit cd1156b
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/pregres/db.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions test/pregres_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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)))

0 comments on commit cd1156b

Please sign in to comment.