test(persist/inventory): add test for adding deferredModule
This feature will allow us to read/write to 'settings' of service 'instances' which are of type deferredModule. Usually a deferredModule needs to be evaulated, but because we use our own type, which forces some constraints, we can safely perform read and write
This commit is contained in:
1
pkgs/clan-cli/clan_lib/persist/fixtures/deferred.json
Normal file
1
pkgs/clan-cli/clan_lib/persist/fixtures/deferred.json
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
28
pkgs/clan-cli/clan_lib/persist/fixtures/deferred.nix
Normal file
28
pkgs/clan-cli/clan_lib/persist/fixtures/deferred.nix
Normal file
@@ -0,0 +1,28 @@
|
||||
{ clanLib, lib, ... }:
|
||||
let
|
||||
eval = lib.evalModules {
|
||||
modules = [
|
||||
{
|
||||
# Trying to write into the default
|
||||
options.foo = lib.mkOption {
|
||||
type = lib.types.attrsOf clanLib.types.uniqueDeferredSerializableModule;
|
||||
};
|
||||
}
|
||||
{
|
||||
foo = {
|
||||
a = { };
|
||||
b = { };
|
||||
};
|
||||
}
|
||||
|
||||
# Merge the "inventory.json"
|
||||
(builtins.fromJSON (builtins.readFile ./deferred.json))
|
||||
];
|
||||
};
|
||||
in
|
||||
{
|
||||
clanInternals.inventoryClass.inventory = eval.config;
|
||||
clanInternals.inventoryClass.introspection = clanLib.introspection.getPrios {
|
||||
options = eval.options;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user