remote: TestStoreConfig no longer needed

This commit is contained in:
sorki 2023-12-09 17:25:26 +01:00
parent 7b41967cc8
commit 656d4dd72d
3 changed files with 9 additions and 22 deletions

View File

@ -17,8 +17,8 @@ deriving via GenericArbitrary CheckMode
deriving via GenericArbitrary SubstituteMode deriving via GenericArbitrary SubstituteMode
instance Arbitrary SubstituteMode instance Arbitrary SubstituteMode
deriving via GenericArbitrary TestStoreConfig deriving via GenericArbitrary ProtoStoreConfig
instance Arbitrary TestStoreConfig instance Arbitrary ProtoStoreConfig
deriving via GenericArbitrary ProtoVersion deriving via GenericArbitrary ProtoVersion
instance Arbitrary ProtoVersion instance Arbitrary ProtoVersion

View File

@ -2,7 +2,6 @@
module System.Nix.Store.Remote.Types.StoreConfig module System.Nix.Store.Remote.Types.StoreConfig
( ProtoStoreConfig(..) ( ProtoStoreConfig(..)
, StoreConfig(..) , StoreConfig(..)
, TestStoreConfig(..)
, HasStoreSocket(..) , HasStoreSocket(..)
) where ) where
@ -21,7 +20,7 @@ instance HasStoreSocket Socket where
data ProtoStoreConfig = ProtoStoreConfig data ProtoStoreConfig = ProtoStoreConfig
{ protoStoreConfig_dir :: StoreDir { protoStoreConfig_dir :: StoreDir
, protoStoreConfig_protoVersion :: ProtoVersion , protoStoreConfig_protoVersion :: ProtoVersion
} } deriving (Eq, Generic, Ord, Show)
instance Default ProtoStoreConfig where instance Default ProtoStoreConfig where
def = ProtoStoreConfig def def def = ProtoStoreConfig def def
@ -36,18 +35,6 @@ instance HasProtoVersion ProtoStoreConfig where
hasProtoVersion = protoStoreConfig_protoVersion hasProtoVersion = protoStoreConfig_protoVersion
data StoreConfig = StoreConfig data StoreConfig = StoreConfig
{ storeConfig_dir :: StoreDir { storeConfig_dir :: Maybe StoreDir
, storeConfig_socketPath :: FilePath , storeConfig_socketPath :: FilePath
}
-- TODO: del
data TestStoreConfig = TestStoreConfig
{ testStoreConfig_dir :: StoreDir
, testStoreConfig_protoVersion :: ProtoVersion
} deriving (Eq, Generic, Ord, Show) } deriving (Eq, Generic, Ord, Show)
instance HasProtoVersion TestStoreConfig where
hasProtoVersion = testStoreConfig_protoVersion
instance HasStoreDir TestStoreConfig where
hasStoreDir = testStoreConfig_dir

View File

@ -17,7 +17,7 @@ import System.Nix.Store.Remote.Arbitrary ()
import System.Nix.Store.Remote.Serializer import System.Nix.Store.Remote.Serializer
import System.Nix.Store.Remote.Types.Logger (Logger(..)) import System.Nix.Store.Remote.Types.Logger (Logger(..))
import System.Nix.Store.Remote.Types.ProtoVersion (HasProtoVersion(..), ProtoVersion(..)) import System.Nix.Store.Remote.Types.ProtoVersion (HasProtoVersion(..), ProtoVersion(..))
import System.Nix.Store.Remote.Types.StoreConfig (TestStoreConfig(..)) import System.Nix.Store.Remote.Types.StoreConfig (ProtoStoreConfig(..))
import System.Nix.Store.Remote.Types.StoreRequest (StoreRequest(..)) import System.Nix.Store.Remote.Types.StoreRequest (StoreRequest(..))
-- | Test for roundtrip using @NixSerializer@ -- | Test for roundtrip using @NixSerializer@
@ -71,7 +71,7 @@ spec = parallel $ do
prop "< 1.28" prop "< 1.28"
$ \sd -> forAll (arbitrary `suchThat` ((< 28) . protoVersion_minor)) $ \sd -> forAll (arbitrary `suchThat` ((< 28) . protoVersion_minor))
$ \pv -> $ \pv ->
roundtripSReader @TestStoreConfig buildResult (TestStoreConfig sd pv) roundtripSReader @ProtoStoreConfig buildResult (ProtoStoreConfig sd pv)
. (\x -> x { buildResultBuiltOutputs = Nothing }) . (\x -> x { buildResultBuiltOutputs = Nothing })
. (\x -> x { buildResultTimesBuilt = Nothing . (\x -> x { buildResultTimesBuilt = Nothing
, buildResultIsNonDeterministic = Nothing , buildResultIsNonDeterministic = Nothing
@ -81,7 +81,7 @@ spec = parallel $ do
) )
prop "= 1.28" prop "= 1.28"
$ \sd -> $ \sd ->
roundtripSReader @TestStoreConfig buildResult (TestStoreConfig sd (ProtoVersion 1 28)) roundtripSReader @ProtoStoreConfig buildResult (ProtoStoreConfig sd (ProtoVersion 1 28))
. (\x -> x { buildResultTimesBuilt = Nothing . (\x -> x { buildResultTimesBuilt = Nothing
, buildResultIsNonDeterministic = Nothing , buildResultIsNonDeterministic = Nothing
, buildResultStartTime = Nothing , buildResultStartTime = Nothing
@ -91,7 +91,7 @@ spec = parallel $ do
prop "> 1.28" prop "> 1.28"
$ \sd -> forAll (arbitrary `suchThat` ((> 28) . protoVersion_minor)) $ \sd -> forAll (arbitrary `suchThat` ((> 28) . protoVersion_minor))
$ \pv -> $ \pv ->
roundtripSReader @TestStoreConfig buildResult (TestStoreConfig sd pv) roundtripSReader @ProtoStoreConfig buildResult (ProtoStoreConfig sd pv)
prop "StorePath" $ prop "StorePath" $
roundtripSReader @StoreDir storePath roundtripSReader @StoreDir storePath
@ -147,7 +147,7 @@ spec = parallel $ do
prop "StoreRequest" prop "StoreRequest"
$ \testStoreConfig -> $ \testStoreConfig ->
forAll (arbitrary `suchThat` (restrictProtoVersion (hasProtoVersion testStoreConfig))) forAll (arbitrary `suchThat` (restrictProtoVersion (hasProtoVersion testStoreConfig)))
$ roundtripSReader @TestStoreConfig storeRequest testStoreConfig $ roundtripSReader @ProtoStoreConfig storeRequest testStoreConfig
describe "StoreReply" $ do describe "StoreReply" $ do
prop "()" $ roundtripS opSuccess prop "()" $ roundtripS opSuccess