mirror of
https://github.com/Smaug123/PulumiConfig
synced 2025-10-08 10:08:40 +00:00
Use Pulumi to provision and Nix to configure (#12)
This commit is contained in:
@@ -22,30 +22,6 @@ module TestConfiguration =
|
||||
return BashString.make s
|
||||
}
|
||||
|
||||
let radicaleConfigGen =
|
||||
gen {
|
||||
let! password = Arb.generate<string>
|
||||
let! username = Arb.generate<string>
|
||||
let! optionValue = Arb.generate<bool>
|
||||
|
||||
if optionValue then
|
||||
let! (NonNull s) = Arb.generate<NonNull<string>>
|
||||
|
||||
return
|
||||
{
|
||||
RadicaleConfig.User = username
|
||||
RadicaleConfig.Password = password
|
||||
RadicaleConfig.GitEmail = Some s
|
||||
}
|
||||
else
|
||||
return
|
||||
{
|
||||
RadicaleConfig.User = username
|
||||
RadicaleConfig.Password = password
|
||||
RadicaleConfig.GitEmail = None
|
||||
}
|
||||
}
|
||||
|
||||
type MyGenerators =
|
||||
static member FileInfo () =
|
||||
{ new Arbitrary<FileInfo>() with
|
||||
@@ -59,12 +35,6 @@ module TestConfiguration =
|
||||
override x.Shrinker t = Seq.empty
|
||||
}
|
||||
|
||||
static member RadicaleConfig () =
|
||||
{ new Arbitrary<RadicaleConfig>() with
|
||||
override x.Generator = radicaleConfigGen
|
||||
override x.Shrinker t = Seq.empty
|
||||
}
|
||||
|
||||
[<Test>]
|
||||
let ``Serialisation round-trip`` () =
|
||||
Arb.register<MyGenerators> () |> ignore
|
||||
@@ -78,26 +48,18 @@ module TestConfiguration =
|
||||
|
||||
[<Test>]
|
||||
let ``Specific example`` () =
|
||||
let config =
|
||||
let publicConfig =
|
||||
{
|
||||
Name = ""
|
||||
PrivateKey = PrivateKey (FileInfo "/tmp")
|
||||
PublicKeyOverride = None
|
||||
AcmeEmail = EmailAddress ""
|
||||
Domain = DomainName ""
|
||||
Cnames = Map.empty
|
||||
Subdomains = Set.empty
|
||||
RemoteUsername = Username ""
|
||||
GiteaConfig = None
|
||||
RadicaleConfig =
|
||||
Some
|
||||
{
|
||||
User = ""
|
||||
Password = ""
|
||||
GitEmail = None
|
||||
}
|
||||
AcmeEmail = EmailAddress "test@example.com"
|
||||
RemoteUsername = Username "non-root"
|
||||
}
|
||||
|
||||
let serialised = SerialisedConfig.Make config
|
||||
let serialised = SerialisedConfig.Make publicConfig
|
||||
let roundTripped = SerialisedConfig.Deserialise serialised
|
||||
config |> shouldEqual roundTripped
|
||||
publicConfig |> shouldEqual roundTripped
|
||||
|
Reference in New Issue
Block a user