Skip to content

Commit 34f9e4d

Browse files
committed
remote: add TestStoreConfig
1 parent c9db11c commit 34f9e4d

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

hnix-store-remote/src/System/Nix/Store/Remote/Arbitrary.hs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ deriving via GenericArbitrary CheckMode
1818
deriving via GenericArbitrary SubstituteMode
1919
instance Arbitrary SubstituteMode
2020

21+
deriving via GenericArbitrary TestStoreConfig
22+
instance Arbitrary TestStoreConfig
23+
2124
deriving via GenericArbitrary ProtoVersion
2225
instance Arbitrary ProtoVersion
2326

hnix-store-remote/src/System/Nix/Store/Remote/Types/StoreConfig.hs

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,17 @@
22
module System.Nix.Store.Remote.Types.StoreConfig
33
( PreStoreConfig(..)
44
, StoreConfig(..)
5+
, TestStoreConfig(..)
56
, HasStoreSocket(..)
67
) where
78

9+
import GHC.Generics (Generic)
810
import Network.Socket (Socket)
911
import System.Nix.StorePath (HasStoreDir(..), StoreDir)
1012
import System.Nix.Store.Remote.Types.ProtoVersion (HasProtoVersion(..), ProtoVersion)
1113

1214
data PreStoreConfig = PreStoreConfig
13-
{ preStoreConfig_dir :: StoreDir
15+
{ preStoreConfig_dir :: StoreDir
1416
, preStoreConfig_socket :: Socket
1517
}
1618

@@ -27,9 +29,9 @@ instance HasStoreSocket PreStoreConfig where
2729
hasStoreSocket = preStoreConfig_socket
2830

2931
data StoreConfig = StoreConfig
30-
{ storeConfig_dir :: StoreDir
32+
{ storeConfig_dir :: StoreDir
3133
, storeConfig_protoVersion :: ProtoVersion
32-
, storeConfig_socket :: Socket
34+
, storeConfig_socket :: Socket
3335
}
3436

3537
instance HasStoreDir StoreDir where
@@ -43,3 +45,14 @@ instance HasProtoVersion StoreConfig where
4345

4446
instance HasStoreSocket StoreConfig where
4547
hasStoreSocket = storeConfig_socket
48+
49+
data TestStoreConfig = TestStoreConfig
50+
{ testStoreConfig_dir :: StoreDir
51+
, testStoreConfig_protoVersion :: ProtoVersion
52+
} deriving (Eq, Generic, Ord, Show)
53+
54+
instance HasProtoVersion TestStoreConfig where
55+
hasProtoVersion = testStoreConfig_protoVersion
56+
57+
instance HasStoreDir TestStoreConfig where
58+
hasStoreDir = testStoreConfig_dir

0 commit comments

Comments
 (0)