packages feed

tmp-postgres 1.13.1.0 → 1.13.1.1

raw patch · 5 files changed

+19/−13 lines, 5 files

Files

CHANGELOG.md view
@@ -42,3 +42,6 @@ 1.13.1.0   #113 Faster shutdown using SIGQUIT and removed manual session termination.   #115 Add password support to optionsToDefaultConfig++1.13.1.1+  #116 Don't create postgres or template1 databases in optionsToDefaultConfig
src/Database/Postgres/Temp/Internal.hs view
@@ -381,7 +381,7 @@ --   want to create a database owned by a specific user you will also login --   with among other use cases. -----   @since 1.12.0.0+--   @since 1.13.1.0 optionsToDefaultConfig :: Client.Options -> Config optionsToDefaultConfig opts@Client.Options {..} =   let generated = optionsToConfig opts
src/Database/Postgres/Temp/Internal/Config.hs view
@@ -761,14 +761,18 @@  -- Adds a @createdb@ ProcessPlan with the argument -- as the database name.+-- It does nothing if the db names are "template1" or+-- "postgres" dbnameToPlan :: String -> Plan-dbnameToPlan dbName = mempty-  { createDbConfig = pure $ mempty-    { commandLine = mempty-      { indexBased = Map.singleton 0 dbName+dbnameToPlan dbName+  | dbName == "template1" || dbName == "postgres" = mempty+  | otherwise = mempty+    { createDbConfig = pure $ mempty+      { commandLine = mempty+        { indexBased = Map.singleton 0 dbName+        }       }     }-  }  -- Adds the 'PGPASSWORD' to both @initdb@ and @createdb@ passwordToPlan :: String -> Plan
test/Spec.hs view
@@ -20,6 +20,7 @@ import Data.Monoid import Network.Socket.Free (getFreePort) import qualified Data.Map.Strict as Map+import Plans ()  main :: IO () main = hspec spec@@ -67,7 +68,9 @@         }       ) -+--+-- This is basically the optionsToDefaultConfig but also tests custom postgresql.conf values+-- Simplify and only test the custom conf and it can be combined with another test customConfigWork :: (Config -> (DB -> IO ()) -> IO ()) -> Spec customConfigWork action = do   let expectedDbName = "thedb"@@ -76,10 +79,6 @@       expectedDuration = "100ms"       extraConfig = "log_min_duration_statement='" <> expectedDuration <> "'" ------ This is basically the optionsToDefaultConfig but also tests custom postgresql.conf values----   it "returns the right client options for the plan" $ withTempDirectory "/tmp" "tmp-postgres-spec" $ \tmpDir -> do     let customPlan = mempty           { temporaryDirectory = pure tmpDir@@ -284,7 +283,7 @@ -- TODO -- combine this test with another plan -- tests that the dbName can be specified in the options---+-- This is covered by optionsToDefaultConfig test     let noCreateTemplate1 = mempty           { plan = mempty               { createDbConfig = Nothing
tmp-postgres.cabal view
@@ -1,5 +1,5 @@ name:                tmp-postgres-version:             1.13.1.0+version:             1.13.1.1 synopsis: Start and stop a temporary postgres description: Start and stop a temporary postgres. See README.md homepage:            https://github.com/jfischoff/tmp-postgres#readme