module Pqi.Conformance.Operation.ResetStart
( spec,
)
where
import qualified Pqi
import Pqi.Conformance.Harness
import Pqi.Conformance.Observation
import Pqi.Conformance.Prelude
import Pqi.Conformance.Scenario (pollUntilDone)
import Test.Hspec
spec :: Pqi.Adapter -> SpecWith ByteString
spec :: Adapter -> SpecWith ByteString
spec Adapter
adapter =
String -> SpecWith ByteString -> SpecWith ByteString
forall a. HasCallStack => String -> SpecWith a -> SpecWith a
describe String
"resetStart" do
String
-> (ByteString -> IO ()) -> SpecWith (Arg (ByteString -> IO ()))
forall a.
(HasCallStack, Example a) =>
String -> a -> SpecWith (Arg a)
it String
"begins an asynchronous reset that polls to a fresh session" \ByteString
conninfo ->
Adapter
-> ByteString
-> (Connection -> IO (Bool, PollingStatus, ConnectionObservation))
-> IO ()
forall a.
(Eq a, Show a, HasCallStack) =>
Adapter -> ByteString -> (Connection -> IO a) -> IO ()
differential Adapter
adapter ByteString
conninfo \Connection
connection -> do
_ <- Connection -> ByteString -> IO (Maybe Result)
Pqi.exec Connection
connection ByteString
"begin"
started <- Pqi.resetStart connection
polled <- pollUntilDone (Pqi.resetPoll connection)
afterReset <- observeConnection connection
pure (started, polled, afterReset)