mirror of
https://github.com/haskell-nix/hnix-store.git
synced 2024-08-17 13:51:21 +03:00
remote: TestStoreConfig no longer needed
This commit is contained in:
parent
7b41967cc8
commit
656d4dd72d
@ -17,8 +17,8 @@ deriving via GenericArbitrary CheckMode
|
||||
deriving via GenericArbitrary SubstituteMode
|
||||
instance Arbitrary SubstituteMode
|
||||
|
||||
deriving via GenericArbitrary TestStoreConfig
|
||||
instance Arbitrary TestStoreConfig
|
||||
deriving via GenericArbitrary ProtoStoreConfig
|
||||
instance Arbitrary ProtoStoreConfig
|
||||
|
||||
deriving via GenericArbitrary ProtoVersion
|
||||
instance Arbitrary ProtoVersion
|
||||
|
@ -2,7 +2,6 @@
|
||||
module System.Nix.Store.Remote.Types.StoreConfig
|
||||
( ProtoStoreConfig(..)
|
||||
, StoreConfig(..)
|
||||
, TestStoreConfig(..)
|
||||
, HasStoreSocket(..)
|
||||
) where
|
||||
|
||||
@ -21,7 +20,7 @@ instance HasStoreSocket Socket where
|
||||
data ProtoStoreConfig = ProtoStoreConfig
|
||||
{ protoStoreConfig_dir :: StoreDir
|
||||
, protoStoreConfig_protoVersion :: ProtoVersion
|
||||
}
|
||||
} deriving (Eq, Generic, Ord, Show)
|
||||
|
||||
instance Default ProtoStoreConfig where
|
||||
def = ProtoStoreConfig def def
|
||||
@ -36,18 +35,6 @@ instance HasProtoVersion ProtoStoreConfig where
|
||||
hasProtoVersion = protoStoreConfig_protoVersion
|
||||
|
||||
data StoreConfig = StoreConfig
|
||||
{ storeConfig_dir :: StoreDir
|
||||
{ storeConfig_dir :: Maybe StoreDir
|
||||
, storeConfig_socketPath :: FilePath
|
||||
}
|
||||
|
||||
-- TODO: del
|
||||
data TestStoreConfig = TestStoreConfig
|
||||
{ testStoreConfig_dir :: StoreDir
|
||||
, testStoreConfig_protoVersion :: ProtoVersion
|
||||
} deriving (Eq, Generic, Ord, Show)
|
||||
|
||||
instance HasProtoVersion TestStoreConfig where
|
||||
hasProtoVersion = testStoreConfig_protoVersion
|
||||
|
||||
instance HasStoreDir TestStoreConfig where
|
||||
hasStoreDir = testStoreConfig_dir
|
||||
|
@ -17,7 +17,7 @@ import System.Nix.Store.Remote.Arbitrary ()
|
||||
import System.Nix.Store.Remote.Serializer
|
||||
import System.Nix.Store.Remote.Types.Logger (Logger(..))
|
||||
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(..))
|
||||
|
||||
-- | Test for roundtrip using @NixSerializer@
|
||||
@ -71,7 +71,7 @@ spec = parallel $ do
|
||||
prop "< 1.28"
|
||||
$ \sd -> forAll (arbitrary `suchThat` ((< 28) . protoVersion_minor))
|
||||
$ \pv ->
|
||||
roundtripSReader @TestStoreConfig buildResult (TestStoreConfig sd pv)
|
||||
roundtripSReader @ProtoStoreConfig buildResult (ProtoStoreConfig sd pv)
|
||||
. (\x -> x { buildResultBuiltOutputs = Nothing })
|
||||
. (\x -> x { buildResultTimesBuilt = Nothing
|
||||
, buildResultIsNonDeterministic = Nothing
|
||||
@ -81,7 +81,7 @@ spec = parallel $ do
|
||||
)
|
||||
prop "= 1.28"
|
||||
$ \sd ->
|
||||
roundtripSReader @TestStoreConfig buildResult (TestStoreConfig sd (ProtoVersion 1 28))
|
||||
roundtripSReader @ProtoStoreConfig buildResult (ProtoStoreConfig sd (ProtoVersion 1 28))
|
||||
. (\x -> x { buildResultTimesBuilt = Nothing
|
||||
, buildResultIsNonDeterministic = Nothing
|
||||
, buildResultStartTime = Nothing
|
||||
@ -91,7 +91,7 @@ spec = parallel $ do
|
||||
prop "> 1.28"
|
||||
$ \sd -> forAll (arbitrary `suchThat` ((> 28) . protoVersion_minor))
|
||||
$ \pv ->
|
||||
roundtripSReader @TestStoreConfig buildResult (TestStoreConfig sd pv)
|
||||
roundtripSReader @ProtoStoreConfig buildResult (ProtoStoreConfig sd pv)
|
||||
|
||||
prop "StorePath" $
|
||||
roundtripSReader @StoreDir storePath
|
||||
@ -147,7 +147,7 @@ spec = parallel $ do
|
||||
prop "StoreRequest"
|
||||
$ \testStoreConfig ->
|
||||
forAll (arbitrary `suchThat` (restrictProtoVersion (hasProtoVersion testStoreConfig)))
|
||||
$ roundtripSReader @TestStoreConfig storeRequest testStoreConfig
|
||||
$ roundtripSReader @ProtoStoreConfig storeRequest testStoreConfig
|
||||
|
||||
describe "StoreReply" $ do
|
||||
prop "()" $ roundtripS opSuccess
|
||||
|
Loading…
Reference in New Issue
Block a user