mirror of
https://github.com/TECHNOFAB11/kubenix.git
synced 2025-12-12 08:00:06 +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
|
||||
++ [
|
||||
{
|
||||
_module.args = {
|
||||
config._module.args = {
|
||||
inherit pkgs;
|
||||
name = "default";
|
||||
};
|
||||
}
|
||||
];
|
||||
specialArgs = {inherit kubenix;};
|
||||
specialArgs = {inherit kubenix;
|
||||
inherit pkgs;
|
||||
};
|
||||
}
|
||||
attrs');
|
||||
in {
|
||||
|
|
|
|||
|
|
@ -32,20 +32,77 @@ with lib; let
|
|||
assert finalType.check coerced; coerced;
|
||||
in
|
||||
finalType.merge loc (map (def: def // {value = coerceVal def.value;}) defs);
|
||||
inherit (finalType) getSubOptions;
|
||||
inherit (finalType) getSubModules;
|
||||
getSubOptions = finalType.getSubOptions;
|
||||
getSubModules = finalType.getSubModules;
|
||||
substSubModules = m: coercedTo coercedType coerceFunc (finalType.substSubModules m);
|
||||
typeMerge = _t1: _t2: null;
|
||||
typeMerge = t1: t2: null;
|
||||
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:
|
||||
types.submodule (_: {
|
||||
inherit (definitions."${ref}") options;
|
||||
inherit (definitions."${ref}") config;
|
||||
types.submodule ({name, ...}: {
|
||||
options = definitions."${ref}".options;
|
||||
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 =
|
||||
{
|
||||
"google_rpc_Status" = {
|
||||
|
|
|
|||
|
|
@ -282,6 +282,13 @@ in {
|
|||
default = null;
|
||||
};
|
||||
|
||||
|
||||
customResources = mkOption {
|
||||
description = "Setup custom resources";
|
||||
type = types.listOf types.attrs;
|
||||
default = [];
|
||||
};
|
||||
|
||||
resourceOrder = mkOption {
|
||||
description = "Preffered resource order";
|
||||
type = types.listOf types.str;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
system ? builtins.currentSystem,
|
||||
evalModules ? (import ../. {}).evalModules.${system},
|
||||
}: {
|
||||
k8sVersion ? "1.21",
|
||||
k8sVersion ? "1.23",
|
||||
registry ? throw "Registry url not defined",
|
||||
doThrowError ? true, # whether any testing error should throw an error
|
||||
enabledTests ? null,
|
||||
|
|
@ -22,13 +22,13 @@
|
|||
tests = [
|
||||
./k8s/simple.nix
|
||||
./k8s/deployment.nix
|
||||
# ./k8s/crd.nix # flaky
|
||||
./k8s/crd.nix # flaky
|
||||
./k8s/defaults.nix
|
||||
./k8s/order.nix
|
||||
./k8s/submodule.nix
|
||||
./k8s/imports.nix
|
||||
#./helm/simple.nix
|
||||
# ./istio/bookinfo.nix # infinite recursion
|
||||
./istio/bookinfo.nix
|
||||
./submodules/simple.nix
|
||||
./submodules/defaults.nix
|
||||
./submodules/versioning.nix
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue