Skip to content

Commit 656d4dd

Browse files
committed
remote: TestStoreConfig no longer needed
1 parent 7b41967 commit 656d4dd

File tree

3 files changed

+9
-22
lines changed

3 files changed

+9
-22
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ deriving via GenericArbitrary CheckMode
1717
deriving via GenericArbitrary SubstituteMode
1818
instance Arbitrary SubstituteMode
1919

20-
deriving via GenericArbitrary TestStoreConfig
21-
instance Arbitrary TestStoreConfig
20+
deriving via GenericArbitrary ProtoStoreConfig
21+
instance Arbitrary ProtoStoreConfig
2222

2323
deriving via GenericArbitrary ProtoVersion
2424
instance Arbitrary ProtoVersion

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

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
module System.Nix.Store.Remote.Types.StoreConfig
33
( ProtoStoreConfig(..)
44
, StoreConfig(..)
5-
, TestStoreConfig(..)
65
, HasStoreSocket(..)
76
) where
87

@@ -21,7 +20,7 @@ instance HasStoreSocket Socket where
2120
data ProtoStoreConfig = ProtoStoreConfig
2221
{ protoStoreConfig_dir :: StoreDir
2322
, protoStoreConfig_protoVersion :: ProtoVersion
24-
}
23+
} deriving (Eq, Generic, Ord, Show)
2524

2625
instance Default ProtoStoreConfig where
2726
def = ProtoStoreConfig def def
@@ -36,18 +35,6 @@ instance HasProtoVersion ProtoStoreConfig where
3635
hasProtoVersion = protoStoreConfig_protoVersion
3736

3837
data StoreConfig = StoreConfig
39-
{ storeConfig_dir :: StoreDir
38+
{ storeConfig_dir :: Maybe StoreDir
4039
, storeConfig_socketPath :: FilePath
41-
}
42-
43-
-- TODO: del
44-
data TestStoreConfig = TestStoreConfig
45-
{ testStoreConfig_dir :: StoreDir
46-
, testStoreConfig_protoVersion :: ProtoVersion
4740
} deriving (Eq, Generic, Ord, Show)
48-
49-
instance HasProtoVersion TestStoreConfig where
50-
hasProtoVersion = testStoreConfig_protoVersion
51-
52-
instance HasStoreDir TestStoreConfig where
53-
hasStoreDir = testStoreConfig_dir

hnix-store-remote/tests/NixSerializerSpec.hs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import System.Nix.Store.Remote.Arbitrary ()
1717
import System.Nix.Store.Remote.Serializer
1818
import System.Nix.Store.Remote.Types.Logger (Logger(..))
1919
import System.Nix.Store.Remote.Types.ProtoVersion (HasProtoVersion(..), ProtoVersion(..))
20-
import System.Nix.Store.Remote.Types.StoreConfig (TestStoreConfig(..))
20+
import System.Nix.Store.Remote.Types.StoreConfig (ProtoStoreConfig(..))
2121
import System.Nix.Store.Remote.Types.StoreRequest (StoreRequest(..))
2222

2323
-- | Test for roundtrip using @NixSerializer@
@@ -71,7 +71,7 @@ spec = parallel $ do
7171
prop "< 1.28"
7272
$ \sd -> forAll (arbitrary `suchThat` ((< 28) . protoVersion_minor))
7373
$ \pv ->
74-
roundtripSReader @TestStoreConfig buildResult (TestStoreConfig sd pv)
74+
roundtripSReader @ProtoStoreConfig buildResult (ProtoStoreConfig sd pv)
7575
. (\x -> x { buildResultBuiltOutputs = Nothing })
7676
. (\x -> x { buildResultTimesBuilt = Nothing
7777
, buildResultIsNonDeterministic = Nothing
@@ -81,7 +81,7 @@ spec = parallel $ do
8181
)
8282
prop "= 1.28"
8383
$ \sd ->
84-
roundtripSReader @TestStoreConfig buildResult (TestStoreConfig sd (ProtoVersion 1 28))
84+
roundtripSReader @ProtoStoreConfig buildResult (ProtoStoreConfig sd (ProtoVersion 1 28))
8585
. (\x -> x { buildResultTimesBuilt = Nothing
8686
, buildResultIsNonDeterministic = Nothing
8787
, buildResultStartTime = Nothing
@@ -91,7 +91,7 @@ spec = parallel $ do
9191
prop "> 1.28"
9292
$ \sd -> forAll (arbitrary `suchThat` ((> 28) . protoVersion_minor))
9393
$ \pv ->
94-
roundtripSReader @TestStoreConfig buildResult (TestStoreConfig sd pv)
94+
roundtripSReader @ProtoStoreConfig buildResult (ProtoStoreConfig sd pv)
9595

9696
prop "StorePath" $
9797
roundtripSReader @StoreDir storePath
@@ -147,7 +147,7 @@ spec = parallel $ do
147147
prop "StoreRequest"
148148
$ \testStoreConfig ->
149149
forAll (arbitrary `suchThat` (restrictProtoVersion (hasProtoVersion testStoreConfig)))
150-
$ roundtripSReader @TestStoreConfig storeRequest testStoreConfig
150+
$ roundtripSReader @ProtoStoreConfig storeRequest testStoreConfig
151151

152152
describe "StoreReply" $ do
153153
prop "()" $ roundtripS opSuccess

0 commit comments

Comments
 (0)