generated from replikativ/datahike-backend-template
-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update store-identity to correctly determine equivalence of configs (#26
- Loading branch information
Showing
4 changed files
with
79 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -183,3 +183,55 @@ | |
(d/delete-database config2) | ||
(is (not (d/database-exists? config))) | ||
(is (not (d/database-exists? config2)))))) | ||
|
||
(deftest ^:integration test-signature | ||
(let [config {:store {:backend :jdbc | ||
:dbtype "postgresql" | ||
:host "localhost" | ||
:dbname "config-test" | ||
:user "alice" | ||
:password "foo" | ||
:table "samezies"} | ||
:schema-flexibility :read | ||
:keep-history? false} | ||
config2 {:store {:backend :jdbc | ||
:jdbcUrl "postgresql://alice:foo@localhost/config-test" | ||
:table "samezies"} | ||
:schema-flexibility :read | ||
:keep-history? false} | ||
config3 {:store {:backend :jdbc | ||
:jdbcUrl "postgresql://alice:[email protected]/config-test" | ||
:table "samezies"} | ||
:schema-flexibility :read | ||
:keep-history? false} | ||
config4 {:store {:backend :jdbc | ||
:jdbcUrl "postgresql://alice:[email protected]/config-test" | ||
:table "different"} | ||
:schema-flexibility :read | ||
:keep-history? false} | ||
_ (d/delete-database config)] | ||
(is (not (d/database-exists? config))) | ||
(let [_ (d/create-database config) | ||
conn (d/connect config) | ||
conn2 (d/connect config2) | ||
conn3 (d/connect config2)] | ||
(is (not (d/database-exists? config4))) | ||
|
||
(d/transact conn [{:db/id 1, :name "Ivan", :age 15} | ||
{:db/id 2, :name "Petr", :age 37} | ||
{:db/id 3, :name "Ivan", :age 37} | ||
{:db/id 4, :age 15}]) | ||
(is (= (d/q '[:find ?e :where [?e :name]] @conn2) | ||
#{[3] [2] [1]})) | ||
|
||
(is (= (d/q '[:find ?e :where [?e :name]] @conn3) | ||
#{[3] [2] [1]})) | ||
|
||
(d/release conn) | ||
(is (d/database-exists? config)) | ||
(is (d/database-exists? config2)) | ||
(is (d/database-exists? config3)) | ||
(d/delete-database config) | ||
(is (not (d/database-exists? config))) | ||
(is (not (d/database-exists? config2))) | ||
(is (not (d/database-exists? config3)))))) |