mirror of
https://github.com/TECHNOFAB11/kubenix.git
synced 2025-12-12 16:10:05 +01:00
enable some tests
This commit is contained in:
parent
f5d82afca7
commit
43371dba54
4 changed files with 78 additions and 12 deletions
|
|
@ -55,13 +55,15 @@
|
||||||
modules
|
modules
|
||||||
++ [
|
++ [
|
||||||
{
|
{
|
||||||
_module.args = {
|
config._module.args = {
|
||||||
inherit pkgs;
|
inherit pkgs;
|
||||||
name = "default";
|
name = "default";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
specialArgs = {inherit kubenix;};
|
specialArgs = {inherit kubenix;
|
||||||
|
inherit pkgs;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
attrs');
|
attrs');
|
||||||
in {
|
in {
|
||||||
|
|
|
||||||
|
|
@ -32,20 +32,77 @@ with lib; let
|
||||||
assert finalType.check coerced; coerced;
|
assert finalType.check coerced; coerced;
|
||||||
in
|
in
|
||||||
finalType.merge loc (map (def: def // {value = coerceVal def.value;}) defs);
|
finalType.merge loc (map (def: def // {value = coerceVal def.value;}) defs);
|
||||||
inherit (finalType) getSubOptions;
|
getSubOptions = finalType.getSubOptions;
|
||||||
inherit (finalType) getSubModules;
|
getSubModules = finalType.getSubModules;
|
||||||
substSubModules = m: coercedTo coercedType coerceFunc (finalType.substSubModules m);
|
substSubModules = m: coercedTo coercedType coerceFunc (finalType.substSubModules m);
|
||||||
typeMerge = _t1: _t2: null;
|
typeMerge = t1: t2: null;
|
||||||
functor = (defaultFunctor name) // {wrapped = finalType;};
|
functor = (defaultFunctor name) // {wrapped = finalType;};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mkOptionDefault = mkOverride 1001;
|
||||||
|
|
||||||
|
extraOptions = {
|
||||||
|
kubenix = {};
|
||||||
|
};
|
||||||
|
|
||||||
|
mergeValuesByKey = mergeKey: values:
|
||||||
|
listToAttrs (map
|
||||||
|
(value:
|
||||||
|
nameValuePair
|
||||||
|
(
|
||||||
|
if isAttrs value.${mergeKey}
|
||||||
|
then toString value.${mergeKey}.content
|
||||||
|
else (toString value.${mergeKey})
|
||||||
|
)
|
||||||
|
value)
|
||||||
|
values);
|
||||||
|
|
||||||
submoduleOf = ref:
|
submoduleOf = ref:
|
||||||
types.submodule (_: {
|
types.submodule ({name, ...}: {
|
||||||
inherit (definitions."${ref}") options;
|
options = definitions."${ref}".options;
|
||||||
inherit (definitions."${ref}") config;
|
config = definitions."${ref}".config;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
submoduleWithMergeOf = ref: mergeKey:
|
||||||
|
types.submodule ({name, ...}: let
|
||||||
|
convertName = name:
|
||||||
|
if definitions."${ref}".options.${mergeKey}.type == types.int
|
||||||
|
then toInt name
|
||||||
|
else name;
|
||||||
|
in {
|
||||||
|
options = definitions."${ref}".options;
|
||||||
|
config =
|
||||||
|
definitions."${ref}".config
|
||||||
|
// {
|
||||||
|
${mergeKey} = mkOverride 1002 (convertName name);
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
submoduleForDefinition = ref: resource: kind: group: version:
|
||||||
|
types.submodule ({name, ...}: {
|
||||||
|
options = definitions."${ref}".options // extraOptions;
|
||||||
|
config = mkMerge ([
|
||||||
|
definitions."${ref}".config
|
||||||
|
{
|
||||||
|
kind = mkOptionDefault kind;
|
||||||
|
apiVersion = mkOptionDefault version;
|
||||||
|
|
||||||
|
# metdata.name cannot use option default, due deep config
|
||||||
|
metadata.name = mkOptionDefault name;
|
||||||
|
}
|
||||||
|
]
|
||||||
|
++ (config.defaults.${resource} or [])
|
||||||
|
++ (config.defaults.all or []));
|
||||||
|
});
|
||||||
|
|
||||||
|
coerceAttrsOfSubmodulesToListByKey = ref: mergeKey: (
|
||||||
|
types.coercedTo
|
||||||
|
(types.listOf (submoduleOf ref))
|
||||||
|
(mergeValuesByKey mergeKey)
|
||||||
|
(types.attrsOf (submoduleWithMergeOf ref mergeKey))
|
||||||
|
);
|
||||||
|
|
||||||
definitions =
|
definitions =
|
||||||
{
|
{
|
||||||
"google_rpc_Status" = {
|
"google_rpc_Status" = {
|
||||||
|
|
|
||||||
|
|
@ -282,6 +282,13 @@ in {
|
||||||
default = null;
|
default = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
customResources = mkOption {
|
||||||
|
description = "Setup custom resources";
|
||||||
|
type = types.listOf types.attrs;
|
||||||
|
default = [];
|
||||||
|
};
|
||||||
|
|
||||||
resourceOrder = mkOption {
|
resourceOrder = mkOption {
|
||||||
description = "Preffered resource order";
|
description = "Preffered resource order";
|
||||||
type = types.listOf types.str;
|
type = types.listOf types.str;
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
system ? builtins.currentSystem,
|
system ? builtins.currentSystem,
|
||||||
evalModules ? (import ../. {}).evalModules.${system},
|
evalModules ? (import ../. {}).evalModules.${system},
|
||||||
}: {
|
}: {
|
||||||
k8sVersion ? "1.21",
|
k8sVersion ? "1.23",
|
||||||
registry ? throw "Registry url not defined",
|
registry ? throw "Registry url not defined",
|
||||||
doThrowError ? true, # whether any testing error should throw an error
|
doThrowError ? true, # whether any testing error should throw an error
|
||||||
enabledTests ? null,
|
enabledTests ? null,
|
||||||
|
|
@ -22,13 +22,13 @@
|
||||||
tests = [
|
tests = [
|
||||||
./k8s/simple.nix
|
./k8s/simple.nix
|
||||||
./k8s/deployment.nix
|
./k8s/deployment.nix
|
||||||
# ./k8s/crd.nix # flaky
|
./k8s/crd.nix # flaky
|
||||||
./k8s/defaults.nix
|
./k8s/defaults.nix
|
||||||
./k8s/order.nix
|
./k8s/order.nix
|
||||||
./k8s/submodule.nix
|
./k8s/submodule.nix
|
||||||
./k8s/imports.nix
|
./k8s/imports.nix
|
||||||
# ./helm/simple.nix
|
#./helm/simple.nix
|
||||||
# ./istio/bookinfo.nix # infinite recursion
|
./istio/bookinfo.nix
|
||||||
./submodules/simple.nix
|
./submodules/simple.nix
|
||||||
./submodules/defaults.nix
|
./submodules/defaults.nix
|
||||||
./submodules/versioning.nix
|
./submodules/versioning.nix
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue