Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lazamar committed Jan 8, 2025
1 parent 76a1315 commit 707be90
Show file tree
Hide file tree
Showing 15 changed files with 38 additions and 473 deletions.
8 changes: 3 additions & 5 deletions emulator.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ executable emulator
other-modules:
build-depends:
base
, ambar-hs-utils
, directory
, emulator-lib
, filepath
Expand Down Expand Up @@ -116,15 +117,12 @@ test-suite emulator-tests
Test.Connector.PostgreSQL
Test.Connector.MicrosoftSQLServer
Test.Emulator
Test.OnDemand
Test.Transport
Test.Warden
Test.Utils.OnDemand
Test.Utils.Docker
Test.Utils.SQL
Test.Util.SQL
type: exitcode-stdio-1.0
build-depends:
base
, ambar-hs-utils
, emulator-lib
, aeson
, async
Expand Down
4 changes: 2 additions & 2 deletions tests/Test/Connector.hs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import Test.Connector.File (testFileConnector)
import Test.Connector.PostgreSQL (PostgresCreds, testPostgreSQL, withPostgreSQL)
import Test.Connector.MySQL (MySQLCreds, testMySQL, withMySQL)
import Test.Connector.MicrosoftSQLServer (MicrosoftSQLServerCreds, testMicrosoftSQLServer, withMicrosoftSQLServer)
import Test.Utils.OnDemand (OnDemand)
import qualified Test.Utils.OnDemand as OnDemand
import Util.OnDemand (OnDemand)
import qualified Util.OnDemand as OnDemand

-- | Info to connect to known databases.
data Databases = Databases
Expand Down
4 changes: 2 additions & 2 deletions tests/Test/Connector/File.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ import Ambar.Emulator.Connector.File (FileConnector, mkFileConnector, write, c_p


import Test.Queue (withFileTopic)
import Utils.Logger (plainLogger, Severity(..))
import Test.Utils.SQL
import Util.Logger (plainLogger, Severity(..))
import Test.Util.SQL

testFileConnector :: Spec
testFileConnector =
Expand Down
8 changes: 4 additions & 4 deletions tests/Test/Connector/MicrosoftSQLServer.hs
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ import Ambar.Emulator.Connector.MicrosoftSQLServer (SQLServer(..))
import Ambar.Record (Bytes(..))
import Database.MicrosoftSQLServer as S

import Test.Utils.Docker (DockerCommand(..), withDocker)
import Test.Utils.OnDemand (OnDemand)
import Test.Utils.SQL
import Util.Docker (DockerCommand(..), withDocker)
import Util.OnDemand (OnDemand)
import Test.Util.SQL
( EventsTable(..)
, Table(..)
, Event(..)
Expand All @@ -41,7 +41,7 @@ import Test.Utils.SQL
, group
)

import Utils.Delay (deadline, seconds)
import Util.Delay (deadline, seconds)

testMicrosoftSQLServer :: OnDemand MicrosoftSQLServerCreds -> Spec
testMicrosoftSQLServer od = do
Expand Down
8 changes: 4 additions & 4 deletions tests/Test/Connector/MySQL.hs
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ import qualified Ambar.Emulator.Queue.Topic as Topic
import Ambar.Emulator.Queue.Topic (PartitionCount(..))
import Ambar.Record (Bytes(..))

import Utils.Delay (deadline, seconds)
import Test.Utils.OnDemand (OnDemand)
import Test.Utils.SQL hiding (Connection)
import qualified Test.Utils.SQL as TS
import Util.Delay (deadline, seconds)
import Util.OnDemand (OnDemand)
import Test.Util.SQL hiding (Connection)
import qualified Test.Util.SQL as TS

type MySQLCreds = ConnectionInfo

Expand Down
10 changes: 5 additions & 5 deletions tests/Test/Connector/PostgreSQL.hs
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ import Ambar.Emulator.Connector.Postgres (PostgreSQL(..))
import Ambar.Emulator.Queue.Topic (Topic, PartitionCount(..))
import qualified Ambar.Emulator.Queue.Topic as Topic
import Ambar.Record (Bytes(..))
import Test.Utils.Docker (DockerCommand(..), withDocker)
import Test.Utils.OnDemand (OnDemand)
import Test.Utils.SQL
import qualified Test.Utils.OnDemand as OnDemand
import Util.Docker (DockerCommand(..), withDocker)
import Util.OnDemand (OnDemand)
import Test.Util.SQL
import qualified Util.OnDemand as OnDemand

import Utils.Delay (deadline, seconds, delay)
import Util.Delay (deadline, seconds, delay)

testPostgreSQL :: OnDemand PostgresCreds -> Spec
testPostgreSQL p = do
Expand Down
12 changes: 6 additions & 6 deletions tests/Test/Emulator.hs
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ import Ambar.Emulator.Connector.Postgres (PostgreSQL)

import Test.Connector.PostgreSQL (PostgresCreds, Event(..), mocks)
import qualified Test.Connector.PostgreSQL as C
import Test.Utils.SQL (EventsTable)
import Test.Utils.OnDemand (OnDemand)
import qualified Test.Utils.OnDemand as OnDemand
import Utils.Async (withAsyncThrow)
import Utils.Delay (deadline, seconds)
import Utils.Logger (plainLogger, Severity(..))
import Test.Util.SQL (EventsTable)
import Util.OnDemand (OnDemand)
import qualified Util.OnDemand as OnDemand
import Util.Async (withAsyncThrow)
import Util.Delay (deadline, seconds)
import Util.Logger (plainLogger, Severity(..))

testEmulator :: OnDemand PostgresCreds -> Spec
testEmulator p = describe "emulator" $ do
Expand Down
127 changes: 0 additions & 127 deletions tests/Test/OnDemand.hs

This file was deleted.

8 changes: 4 additions & 4 deletions tests/Test/Queue.hs
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ import qualified Ambar.Emulator.Queue.Topic as T
import Ambar.Emulator.Queue.Partition (Partition, Position(..), Record(..))
import qualified Ambar.Emulator.Queue.Partition as P
import qualified Ambar.Emulator.Queue.Partition.File as FilePartition
import Utils.Async (withAsyncThrow)
import Utils.Some (Some(..))
import Utils.Delay (delay, deadline, seconds, millis, hang)
import Utils.Warden (withWarden)
import Util.Async (withAsyncThrow)
import Util.Some (Some(..))
import Util.Delay (delay, deadline, seconds, millis, hang)
import Util.Warden (withWarden)

testQueues :: Spec
testQueues = do
Expand Down
4 changes: 2 additions & 2 deletions tests/Test/Transport.hs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ import qualified Ambar.Transport.Http as HttpTransport
import Ambar.Transport (Transport(..))
import Ambar.Transport.Http (Endpoint(..), User(..), Password(..))

import Utils.Async (withAsyncThrow)
import Utils.Some (Some(..))
import Util.Async (withAsyncThrow)
import Util.Some (Some(..))

testTransport :: Spec
testTransport = describe "transport" $ do
Expand Down
12 changes: 6 additions & 6 deletions tests/Test/Utils/SQL.hs → tests/Test/Util/SQL.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{-# OPTIONS_GHC -Wno-x-partial #-}
-- | Utilities for testing SQL connectors
module Test.Utils.SQL
module Test.Util.SQL
( Table(..)
, testGenericSQL
, mkTableName
Expand Down Expand Up @@ -36,12 +36,12 @@ import Ambar.Emulator.Connector (partitioner, encoder, Connector(..))
import Ambar.Emulator.Queue.Topic (Topic, PartitionCount(..))
import qualified Ambar.Emulator.Queue.Topic as Topic
import Test.Queue (withFileTopic)
import Test.Utils.OnDemand (OnDemand)
import qualified Test.Utils.OnDemand as OnDemand
import Util.OnDemand (OnDemand)
import qualified Util.OnDemand as OnDemand

import Utils.Async (withAsyncThrow)
import Utils.Delay (deadline, seconds)
import Utils.Logger (plainLogger, Severity(..))
import Util.Async (withAsyncThrow)
import Util.Delay (deadline, seconds)
import Util.Logger (plainLogger, Severity(..))

-- An SQL table
class Table a where
Expand Down
Loading

0 comments on commit 707be90

Please sign in to comment.