Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to hw-polysemy-0.3.1.1 #29

Merged
merged 1 commit into from
Dec 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,14 @@ jobs:
strategy:
fail-fast: false
matrix:
ghc: ["9.6.6"]
os: [ubuntu-latest]
ghc: ["9.4.8", "9.6.6"]
os:
- ubuntu-latest
include:
- ghc: "9.6.6"
os: macOS-latest
- ghc: "9.6.6"
os: windows-latest

steps:
- uses: actions/checkout@v2
Expand Down
5 changes: 5 additions & 0 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,8 @@ package amazonka-sts

constraints:
text < 2.1.2

allow-newer:
base,
bytestring,
containers,
138 changes: 74 additions & 64 deletions integration/Test/Data/RdsData/Migration/ConnectionSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -31,74 +31,84 @@ import HaskellWorks.Polysemy.Hedgehog
import HaskellWorks.Polysemy.Prelude
import HaskellWorks.TestContainers.LocalStack
import Lens.Micro
import qualified System.Info as OS
import qualified Test.Tasty as Tasty
import qualified Test.Tasty.Hedgehog as H
import qualified TestContainers.Tasty as TC

isWindows :: Bool
isWindows = OS.os == "mingw32"

isMacos :: Bool
isMacos = OS.os == "darwin"

-- cabal test rds-data-test --test-options "--pattern \"/RDS integration test/\""
tasty_rds_integration_test :: Tasty.TestTree
tasty_rds_integration_test =
TC.withContainers (setupContainers' projectDefaultLocalStack) $ \getContainer ->
H.testProperty "RDS integration test" $ propertyOnce $ localWorkspace "rds-data" $ runLocalTestEnv getContainer $ do
rdsClusterDetails <- createRdsDbCluster "rds_data_migration" getContainer

dbClusterArn <- rdsClusterDetails ^. the @"createDbClusterResponse" . the @"dbCluster" . _Just . the @"dbClusterArn"
& nothingFail

runReaderStatementContextFromClusterDetails rdsClusterDetails $ do
waitUntilRdsDbClusterAvailable dbClusterArn
& trapFail @AWS.Error
& jotShowDataLog @AwsLogEntry

initialiseDb
& trapFail @RdsDataError
& trapFail @AWS.Error
& jotShowDataLog @AwsLogEntry

migrateUp "db/migration.yaml"
& trapFail @AWS.Error
& trapFail @IOException
& trapFail @JsonDecodeError
& trapFail @RdsDataError
& trapFail @YamlDecodeError
& jotShowDataLog

upResult <-
( executeStatement $ mconcat
[ "SELECT table_name"
, " FROM information_schema.tables"
, " WHERE table_schema = 'public'"
, " AND table_type = 'BASE TABLE';"
]
)
& trapFail @AWS.Error
& trapFail @RdsDataError
& jotShowDataLog

let upTables = upResult ^.. the @"records" . each . each . each . the @"stringValue" . _Just

L.sort upTables === ["examples", "migration", "projects", "users"]

migrateDown "db/migration.yaml"
& trapFail @AWS.Error
& trapFail @IOException
& trapFail @JsonDecodeError
& trapFail @RdsDataError
& trapFail @YamlDecodeError
& jotShowDataLog

downResult <-
( executeStatement $ mconcat
[ "SELECT table_name"
, " FROM information_schema.tables"
, " WHERE table_schema = 'public'"
, " AND table_type = 'BASE TABLE'"
]
)
& trapFail @AWS.Error
& trapFail @RdsDataError
& jotShowDataLog

let downTables = downResult ^.. the @"records" . each . each . each . the @"stringValue" . _Just

L.sort downTables === ["migration"]
if isWindows || isMacos
then Tasty.testGroup "LocalStackSpec skipped on Windows and MacOS" []
else
TC.withContainers (setupContainers' projectDefaultLocalStack) $ \getContainer ->
H.testProperty "RDS integration test" $ propertyOnce $ localWorkspace "rds-data" $ runLocalTestEnv getContainer $ do
rdsClusterDetails <- createRdsDbCluster "rds_data_migration" getContainer

dbClusterArn <- rdsClusterDetails ^. the @"createDbClusterResponse" . the @"dbCluster" . _Just . the @"dbClusterArn"
& nothingFail

runReaderStatementContextFromClusterDetails rdsClusterDetails $ do
waitUntilRdsDbClusterAvailable dbClusterArn
& trapFail @AWS.Error
& jotShowDataLog @AwsLogEntry

initialiseDb
& trapFail @RdsDataError
& trapFail @AWS.Error
& jotShowDataLog @AwsLogEntry

migrateUp "db/migration.yaml"
& trapFail @AWS.Error
& trapFail @IOException
& trapFail @JsonDecodeError
& trapFail @RdsDataError
& trapFail @YamlDecodeError
& jotShowDataLog

upResult <-
( executeStatement $ mconcat
[ "SELECT table_name"
, " FROM information_schema.tables"
, " WHERE table_schema = 'public'"
, " AND table_type = 'BASE TABLE';"
]
)
& trapFail @AWS.Error
& trapFail @RdsDataError
& jotShowDataLog

let upTables = upResult ^.. the @"records" . each . each . each . the @"stringValue" . _Just

L.sort upTables === ["examples", "migration", "projects", "users"]

migrateDown "db/migration.yaml"
& trapFail @AWS.Error
& trapFail @IOException
& trapFail @JsonDecodeError
& trapFail @RdsDataError
& trapFail @YamlDecodeError
& jotShowDataLog

downResult <-
( executeStatement $ mconcat
[ "SELECT table_name"
, " FROM information_schema.tables"
, " WHERE table_schema = 'public'"
, " AND table_type = 'BASE TABLE'"
]
)
& trapFail @AWS.Error
& trapFail @RdsDataError
& jotShowDataLog

let downTables = downResult ^.. the @"records" . each . each . each . the @"stringValue" . _Just

L.sort downTables === ["migration"]
10 changes: 5 additions & 5 deletions rds-data.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ maintainer: [email protected]
copyright: 2024 John Ky
license: BSD-3-Clause
license-file: LICENSE
tested-with: GHC == 9.6.6
tested-with: GHC == 9.6.6, GHC == 9.4.8
build-type: Simple
extra-source-files: README.md

Expand All @@ -39,10 +39,10 @@ common generic-lens { build-depends: generic-lens
common hedgehog { build-depends: hedgehog >= 1.4 && < 2 }
common hedgehog-extras { build-depends: hedgehog-extras >= 0.6.0.2 && < 0.7 }
common http-client { build-depends: http-client >= 0.5.14 && < 0.8 }
common hw-polysemy-amazonka { build-depends: hw-polysemy:amazonka >= 0.3.1 && < 0.4 }
common hw-polysemy-core { build-depends: hw-polysemy:core >= 0.3.1 && < 0.4 }
common hw-polysemy-hedgehog { build-depends: hw-polysemy:hedgehog >= 0.3.1 && < 0.4 }
common hw-polysemy-testcontainers-localstack { build-depends: hw-polysemy:testcontainers-localstack >= 0.3.1 && < 0.4 }
common hw-polysemy-amazonka { build-depends: hw-polysemy:amazonka >= 0.3.1.1 && < 0.4 }
common hw-polysemy-core { build-depends: hw-polysemy:core >= 0.3.1.1 && < 0.4 }
common hw-polysemy-hedgehog { build-depends: hw-polysemy:hedgehog >= 0.3.1.1 && < 0.4 }
common hw-polysemy-testcontainers-localstack { build-depends: hw-polysemy:testcontainers-localstack >= 0.3.1.1 && < 0.4 }
common hw-prelude { build-depends: hw-prelude >= 0.0.1.0 && < 0.1 }
common microlens { build-depends: microlens >= 0.4.13 && < 0.5 }
common mtl { build-depends: mtl >= 2 && < 3 }
Expand Down
Loading