diff --git a/hnix-store-remote/src/System/Nix/Store/Remote/Arbitrary.hs b/hnix-store-remote/src/System/Nix/Store/Remote/Arbitrary.hs index 0b9386f..3a08a87 100644 --- a/hnix-store-remote/src/System/Nix/Store/Remote/Arbitrary.hs +++ b/hnix-store-remote/src/System/Nix/Store/Remote/Arbitrary.hs @@ -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 diff --git a/hnix-store-remote/src/System/Nix/Store/Remote/Types/StoreConfig.hs b/hnix-store-remote/src/System/Nix/Store/Remote/Types/StoreConfig.hs index 20611d3..59f5523 100644 --- a/hnix-store-remote/src/System/Nix/Store/Remote/Types/StoreConfig.hs +++ b/hnix-store-remote/src/System/Nix/Store/Remote/Types/StoreConfig.hs @@ -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 diff --git a/hnix-store-remote/tests/NixSerializerSpec.hs b/hnix-store-remote/tests/NixSerializerSpec.hs index 0fa2115..e229fff 100644 --- a/hnix-store-remote/tests/NixSerializerSpec.hs +++ b/hnix-store-remote/tests/NixSerializerSpec.hs @@ -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