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

Renamed test modules #5028

Merged
merged 4 commits into from
Dec 23, 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
7 changes: 7 additions & 0 deletions ouroboros-network-framework/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@
affects its API.
* Added `connStateSupply` record field to
`Ouroboros.Network.ConnectionManager.Core.Arguments`.
* Renamed modules in `ouroboros-network:testlib`:
`Ouroboros.Network.Test.Orphans -> Test.Ouroboros.Network.Orphans`
`Ouroboros.Network.ConnectionManager.Test.Experiments -> Test.Ouroboros.Network.ConnectionManager.Experiments`
`Ouroboros.Network.ConnectionManager.Test.Timeouts -> Test.Ouroboros.Network.ConnectionManager.Timeouts`
`Ouroboros.Network.ConnectionManager.Test.Utils -> Test.Ouroboros.Network.ConnectionManager.Utils`
`Ouroboros.Network.InboundGovernor.Test.Utils -> Test.Ouroboros.Network.InboundGovernor.Utils`


### Non-breaking changes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ import Control.Monad.Class.MonadTimer.SI
import Control.Monad.IOSim
import Control.Tracer

import Ouroboros.Network.Test.Orphans ()
import Test.Ouroboros.Network.Orphans ()

import Test.QuickCheck
import Test.Tasty (TestTree, testGroup)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ module Test.Ouroboros.Network.RawBearer where

import Ouroboros.Network.IOManager
import Ouroboros.Network.RawBearer
import Ouroboros.Network.RawBearer.Test.Utils
import Ouroboros.Network.Snocket
import Test.Ouroboros.Network.RawBearer.Utils

import Control.Concurrent.Class.MonadMVar
import Control.Monad.Class.MonadThrow (catchJust, finally)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ import Ouroboros.Network.IOManager
import Ouroboros.Network.Snocket (socketSnocket)
import Ouroboros.Network.Socket (configureSocket)

import Ouroboros.Network.ConnectionManager.Test.Experiments
import Ouroboros.Network.ConnectionManager.Test.Timeouts
import Ouroboros.Network.Test.Orphans ()
import Test.Ouroboros.Network.ConnectionManager.Experiments
import Test.Ouroboros.Network.ConnectionManager.Timeouts
import Test.Ouroboros.Network.Orphans ()

tests :: TestTree
tests =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ import Ouroboros.Network.Protocol.Handshake.Codec
import Ouroboros.Network.Protocol.Handshake.Unversioned
import Ouroboros.Network.Protocol.Handshake.Version

import Ouroboros.Network.Test.Orphans ()
import Test.Ouroboros.Network.Orphans ()

import Test.QuickCheck
import Test.Tasty (DependencyType (..), TestTree, after, testGroup)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ import Ouroboros.Network.Subscription.Subscriber
import Ouroboros.Network.Subscription.Worker (LocalAddresses (..),
WorkerParams (..))

import Ouroboros.Network.Test.Orphans ()
import Test.Ouroboros.Network.Orphans ()

import Test.QuickCheck
import Test.Tasty (TestTree, testGroup)
Expand Down
12 changes: 6 additions & 6 deletions ouroboros-network-framework/ouroboros-network-framework.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,12 @@ library testlib
visibility: public
hs-source-dirs: testlib
exposed-modules:
Ouroboros.Network.ConnectionManager.Test.Experiments
Ouroboros.Network.ConnectionManager.Test.Timeouts
Ouroboros.Network.ConnectionManager.Test.Utils
Ouroboros.Network.InboundGovernor.Test.Utils
Ouroboros.Network.RawBearer.Test.Utils
Ouroboros.Network.Test.Orphans
Test.Ouroboros.Network.ConnectionManager.Experiments
Test.Ouroboros.Network.ConnectionManager.Timeouts
Test.Ouroboros.Network.ConnectionManager.Utils
Test.Ouroboros.Network.InboundGovernor.Utils
Test.Ouroboros.Network.Orphans
Test.Ouroboros.Network.RawBearer.Utils

other-modules:
build-depends:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,15 @@ import Test.Tasty.QuickCheck (testProperty)
import Ouroboros.Network.ConnectionId (ConnectionId (..))
import Ouroboros.Network.ConnectionManager.Core qualified as CM
import Ouroboros.Network.ConnectionManager.State qualified as CM
import Ouroboros.Network.ConnectionManager.Test.Utils (verifyAbstractTransition)
import Ouroboros.Network.ConnectionManager.Types
import Ouroboros.Network.MuxMode
import Ouroboros.Network.NodeToNode.Version (DiffusionMode (..))
import Ouroboros.Network.Server.RateLimiting
import Ouroboros.Network.Snocket (Accept (..), Accepted (..),
AddressFamily (TestFamily), Snocket (..), TestAddress (..))

import Test.Ouroboros.Network.ConnectionManager.Utils (verifyAbstractTransition)

import Ouroboros.Network.ConnectionManager.InformationChannel
(newInformationChannel)
import Ouroboros.Network.ConnectionManager.InformationChannel qualified as InfoChannel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ module Test.Ouroboros.Network.RawBearer where
import Ouroboros.Network.IOManager
import Ouroboros.Network.RawBearer
import Ouroboros.Network.Snocket
import Ouroboros.Network.Testing.Data.AbsBearerInfo

import Control.Concurrent.Class.MonadMVar
import Control.Exception (Exception)
Expand All @@ -34,6 +33,7 @@ import System.Directory (removeFile)
import System.IO.Error (ioeGetErrorType, isDoesNotExistErrorType)
import System.IO.Unsafe

import Test.Ouroboros.Network.Data.AbsBearerInfo
import Test.Simulation.Network.Snocket (toBearerInfo)
import Test.Tasty
import Test.Tasty.QuickCheck
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,23 +94,21 @@ import Ouroboros.Network.Snocket qualified as Snocket

import Simulation.Network.Snocket

import Ouroboros.Network.Testing.Data.AbsBearerInfo hiding (delay)
import Ouroboros.Network.Testing.Utils (WithName (..), WithTime (..),
genDelayWithPrecision, nightlyTest, sayTracer, tracerWithTime)

import Ouroboros.Network.Test.Orphans ()
import Test.Simulation.Network.Snocket hiding (tests)

import Ouroboros.Network.ConnectionManager.Test.Experiments
import Ouroboros.Network.ConnectionManager.Test.Timeouts
import Ouroboros.Network.ConnectionManager.Test.Utils
import Test.Ouroboros.Network.ConnectionManager.Experiments
import Test.Ouroboros.Network.ConnectionManager.Timeouts
import Test.Ouroboros.Network.ConnectionManager.Utils
(abstractStateIsFinalTransition, allValidTransitionsNames,
validTransitionMap, verifyAbstractTransition,
verifyAbstractTransitionOrder)
import Ouroboros.Network.InboundGovernor.Test.Utils
import Test.Ouroboros.Network.Data.AbsBearerInfo hiding (delay)
import Test.Ouroboros.Network.InboundGovernor.Utils
(allValidRemoteTransitionsNames, remoteStrIsFinalTransition,
validRemoteTransitionMap, verifyRemoteTransition,
verifyRemoteTransitionOrder)
import Test.Ouroboros.Network.Orphans ()
import Test.Ouroboros.Network.Utils (WithName (..), WithTime (..),
genDelayWithPrecision, nightlyTest, sayTracer, tracerWithTime)
import Test.Simulation.Network.Snocket hiding (tests)

tests :: TestTree
tests =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ import Ouroboros.Network.Protocol.Handshake.Codec
import Ouroboros.Network.Protocol.Handshake.Unversioned
import Ouroboros.Network.Protocol.Handshake.Version

import Ouroboros.Network.Test.Orphans ()
import Test.Ouroboros.Network.Orphans ()

import Test.QuickCheck
import Test.Tasty (DependencyType (..), TestTree, after, testGroup)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ import Ouroboros.Network.Subscription.Subscriber
import Ouroboros.Network.Subscription.Worker (LocalAddresses (..),
WorkerParams (..))

import Ouroboros.Network.Test.Orphans ()
import Test.Ouroboros.Network.Orphans ()

import Test.QuickCheck
import Test.Tasty (TestTree, testGroup)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ import Network.TypedProtocol.ReqResp.Client
import Network.TypedProtocol.ReqResp.Server
import Network.TypedProtocol.ReqResp.Type

import Ouroboros.Network.Test.Orphans ()
import Ouroboros.Network.Testing.Data.AbsBearerInfo
import Test.Ouroboros.Network.Data.AbsBearerInfo
import Test.Ouroboros.Network.Orphans ()

import Test.QuickCheck hiding (Result (..))
import Test.QuickCheck.Instances.ByteString ()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import Ouroboros.Network.ConnectionId
import Ouroboros.Network.ConnectionManager.ConnMap as ConnMap
import Ouroboros.Network.ConnectionManager.Types

import Ouroboros.Network.Testing.Utils (WithName (..))
import Test.Ouroboros.Network.Utils (WithName (..))

-- | 'ConnectionManager' state: for each peer we keep a 'ConnectionState' in
-- a mutable variable, which reduces congestion on the 'TMVar' which keeps
Expand Down
30 changes: 19 additions & 11 deletions ouroboros-network-framework/src/Ouroboros/Network/Socket.hs
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,10 @@ module Ouroboros.Network.Socket
, sockAddrFamily
) where

import Control.Concurrent.Async
import Control.Applicative (Alternative)
import Control.Concurrent.Class.MonadSTM.Strict
import Control.Exception (SomeException (..))
import Control.Monad.Class.MonadAsync
-- TODO: remove this, it will not be needed when `orElse` PR will be merged.
import Codec.CBOR.Read qualified as CBOR
import Codec.CBOR.Term qualified as CBOR
Expand Down Expand Up @@ -315,7 +316,7 @@ connectToNodeWithMux
-> vData
-> OuroborosApplicationWithMinimalCtx muxMode addr BL.ByteString IO a b
-> Mx.Mux muxMode IO
-> Async ()
-> Async IO ()
-> IO x)
-- ^ callback which has access to ConnectionId, negotiated protocols, mux
-- handle created for that connection and an `Async` handle to the thread
Expand Down Expand Up @@ -381,7 +382,7 @@ connectToNodeWithMux'
-> vData
-> OuroborosApplicationWithMinimalCtx muxMode addr BL.ByteString IO a b
-> Mx.Mux muxMode IO
-> Async ()
-> Async IO ()
-> IO x)
-- ^ callback which has access to ConnectionId, negotiated protocols, mux
-- handle created for that connection and an `Async` handle to the thread
Expand Down Expand Up @@ -450,13 +451,20 @@ connectToNodeWithMux'
-- first terminated mini-protocol.
--
simpleMuxCallback
:: ConnectionId addr
:: forall muxMode addr vNumber vData m a b.
( Alternative (STM m)
, MonadAsync m
, MonadSTM m
, MonadThrow m
, MonadThrow (STM m)
)
=> ConnectionId addr
-> vNumber
-> vData
-> OuroborosApplicationWithMinimalCtx muxMode addr BL.ByteString IO a b
-> Mx.Mux muxMode IO
-> Async ()
-> IO (Either SomeException (Either a b))
-> OuroborosApplicationWithMinimalCtx muxMode addr BL.ByteString m a b
-> Mx.Mux muxMode m
-> Async m ()
-> m (Either SomeException (Either a b))
simpleMuxCallback connectionId _ _ app mux aid = do
let initCtx = MinimalInitiatorContext connectionId
respCtx = ResponderContext connectionId
Expand Down Expand Up @@ -487,7 +495,7 @@ simpleMuxCallback connectionId _ _ app mux aid = do
wait aid
return r
where
waitOnAny :: [STM IO (Either SomeException x)] -> IO (Either SomeException x)
waitOnAny :: [STM m (Either SomeException x)] -> m (Either SomeException x)
waitOnAny = atomically . runFirstToFinish . foldMap FirstToFinish


Expand Down Expand Up @@ -862,7 +870,7 @@ withServerNode
-- a given address. Note that if @'MuxClientAndServerApplication'@ is
-- returned, the connection will run a full duplex set of mini-protocols.
-> ErrorPolicies
-> (addr -> Async Void -> IO t)
-> (addr -> Async IO Void -> IO t)
-- ^ callback which takes the @Async@ of the thread that is running the server.
-- Note: the server thread will terminate when the callback returns or
-- throws an exception.
Expand Down Expand Up @@ -937,7 +945,7 @@ withServerNode'
-- a given address. Note that if @'MuxClientAndServerApplication'@ is
-- returned, the connection will run a full duplex set of mini-protocols.
-> ErrorPolicies
-> (addr -> Async Void -> IO t)
-> (addr -> Async IO Void -> IO t)
-- ^ callback which takes the @Async@ of the thread that is running the server.
-- Note: the server thread will terminate when the callback returns or
-- throws an exception.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ import Ouroboros.Network.ConnectionManager.Types (AddressType (..))
import Ouroboros.Network.RawBearer
import Ouroboros.Network.Snocket

import Ouroboros.Network.Testing.Data.Script (Script (..), stepScriptSTM)
import Test.Ouroboros.Network.Data.Script (Script (..), stepScriptSTM)

data Connection m addr = Connection
{ -- | Attenuated channels of a connection.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
-- | This module contains experiments which can be executed either in `IO` or
-- in `IOSim`.
--
module Ouroboros.Network.ConnectionManager.Test.Experiments
module Test.Ouroboros.Network.ConnectionManager.Experiments
( ClientAndServerData (..)
, unidirectionalExperiment
, bidirectionalExperiment
Expand Down Expand Up @@ -97,14 +97,13 @@ import Ouroboros.Network.Server2 (RemoteTransitionTrace)
import Ouroboros.Network.Server2 qualified as Server
import Ouroboros.Network.Snocket (Snocket)
import Ouroboros.Network.Snocket qualified as Snocket
import Ouroboros.Network.Testing.Utils (WithName (..))

import Ouroboros.Network.Test.Orphans ()
-- import Test.Simulation.Network.Snocket hiding (tests)
import Test.Ouroboros.Network.ConnectionManager.Timeouts
import Test.Ouroboros.Network.Orphans ()
import Test.Ouroboros.Network.Utils (WithName (..))

import Ouroboros.Network.ConnectionManager.InformationChannel
(newInformationChannel)
import Ouroboros.Network.ConnectionManager.Test.Timeouts


--
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE NamedFieldPuns #-}

module Ouroboros.Network.ConnectionManager.Test.Timeouts
module Test.Ouroboros.Network.ConnectionManager.Timeouts
( verifyAllTimeouts
, SimAddr
, SimAddr_
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE ScopedTypeVariables #-}

module Ouroboros.Network.ConnectionManager.Test.Utils where
module Test.Ouroboros.Network.ConnectionManager.Utils where

import Prelude hiding (read)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ViewPatterns #-}
module Ouroboros.Network.InboundGovernor.Test.Utils where

module Test.Ouroboros.Network.InboundGovernor.Utils where

import Test.QuickCheck
import Test.QuickCheck.Monoids
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{-# OPTIONS_GHC -Wno-orphans #-}
module Ouroboros.Network.Test.Orphans () where
module Test.Ouroboros.Network.Orphans () where

import Network.TypedProtocol.PingPong.Type (PingPong)
import Network.TypedProtocol.ReqResp.Type (ReqResp)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}

module Ouroboros.Network.RawBearer.Test.Utils where
module Test.Ouroboros.Network.RawBearer.Utils where

import Ouroboros.Network.RawBearer
import Ouroboros.Network.Snocket
Expand Down
1 change: 1 addition & 0 deletions ouroboros-network-protocols/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Breaking changes

* Renamed `Test.Ouroboros.Network.Testing.Utils -> Test.Ouroboros.Network.Protocol.Utils`
* Removed deprecated APIs:
* `chainSyncClientNull`
* `localStateQueryClientNull`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ library testlib
Test.ChainProducerState
Test.Data.CDDL
Test.Data.PipeliningDepth
Test.Ouroboros.Network.Testing.Utils
Test.Ouroboros.Network.Protocol.Utils

build-depends:
QuickCheck,
Expand Down
2 changes: 1 addition & 1 deletion ouroboros-network-protocols/test/Test/Chain.hs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ import Test.Tasty.QuickCheck (testProperty)
import Ouroboros.Network.Block (blockPrevHash, pattern GenesisPoint, pointHash)
import Ouroboros.Network.Mock.Chain (Chain (..))
import Ouroboros.Network.Mock.Chain qualified as Chain
import Ouroboros.Network.Testing.Serialise (prop_serialise)

import Test.ChainGenerators hiding (tests)
import Test.Ouroboros.Network.Serialise (prop_serialise)


--
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import Ouroboros.Network.Protocol.BlockFetch.Type
import Test.Data.PipeliningDepth (PipeliningDepth (..))

import Test.ChainGenerators (TestChainAndPoints (..))
import Test.Ouroboros.Network.Testing.Utils (prop_codec_cborM,
import Test.Ouroboros.Network.Protocol.Utils (prop_codec_cborM,
prop_codec_valid_cbor_encoding, splits2, splits3)

import Test.QuickCheck
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ import Test.Data.PipeliningDepth (PipeliningDepth (..))

import Test.ChainGenerators ()
import Test.ChainProducerState (ChainProducerStateForkTest (..))
import Test.Ouroboros.Network.Testing.Utils (prop_codec_cborM,
import Test.Ouroboros.Network.Protocol.Utils (prop_codec_cborM,
prop_codec_valid_cbor_encoding, splits2, splits3)

import Test.QuickCheck hiding (Result)
Expand Down
Loading
Loading