File: 0001-Use-system-instance-for-PostgreSQL-tests.patch

package info (click to toggle)
next-jdbc-clojure 1.3.955-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 876 kB
  • sloc: xml: 62; sh: 39; makefile: 13
file content (54 lines) | stat: -rw-r--r-- 2,268 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
Description: Use system instance for PostgreSQL tests
Author: Jérôme Charaoui <jerome@riseup.net>
Last-Update: Tue, 01 Apr 2025 16:20:26 -0400
Forwarded: not-needed

Index: next-jdbc-clojure/test/next/jdbc/test_fixtures.clj
===================================================================
--- next-jdbc-clojure.orig/test/next/jdbc/test_fixtures.clj
+++ next-jdbc-clojure/test/next/jdbc/test_fixtures.clj
@@ -5,8 +5,7 @@
   (:require [clojure.string :as str]
             [next.jdbc :as jdbc]
             [next.jdbc.prepare :as prep]
-            [next.jdbc.sql :as sql])
-  (:import (io.zonky.test.db.postgres.embedded EmbeddedPostgres)))
+            [next.jdbc.sql :as sql]))
 
 (set! *warn-on-reflection* true)
 
@@ -21,11 +20,11 @@
 (def ^:private test-sqlite {:dbtype "sqlite" :dbname "clojure_test_sqlite"})
 
 ;; this is just a dummy db-spec -- it's handled in with-test-db below
-(def ^:private test-postgres-map {:dbtype "embedded-postgres" :dbname "clojure_test"})
+(def ^:private test-postgres-map {:dbtype "postgres" :dbname "clojure_test" :port (System/getenv "PGPORT")})
 (def ^:private test-postgres
   (when-not (System/getenv "NEXT_JDBC_NO_POSTGRES") test-postgres-map))
 ;; it takes a while to spin up so we kick it off at startup
-(defonce embedded-pg (when test-postgres (future (EmbeddedPostgres/start))))
+;;(defonce embedded-pg (when test-postgres (future (EmbeddedPostgres/start))))
 
 (def ^:private test-mysql-map
   (merge (if (System/getenv "NEXT_JDBC_TEST_MARIADB")
@@ -84,7 +83,7 @@
 
 (defn mysql? [] (#{"mariadb" "mysql"} (:dbtype @test-db-spec)))
 
-(defn postgres? [] (= "embedded-postgres" (:dbtype @test-db-spec)))
+(defn postgres? [] (= "postgres" (:dbtype @test-db-spec)))
 
 (defn sqlite? [] (= "sqlite" (:dbtype @test-db-spec)))
 
@@ -135,10 +134,7 @@
   [t]
   (doseq [db test-db-specs]
     (reset! test-db-spec db)
-    (if (= "embedded-postgres" (:dbtype db))
-      (reset! test-datasource
-              (.getPostgresDatabase ^EmbeddedPostgres @embedded-pg))
-      (reset! test-datasource (jdbc/get-datasource db)))
+    (reset! test-datasource (jdbc/get-datasource db))
     (let [fruit (if (mysql?) "fruit" "FRUIT") ; MySQL is case sensitive!
           btest (if (mysql?) "btest" "BTEST")
           auto-inc-pk