feat(legacy): improve tests for crd

This commit is contained in:
Jaka Hudoklin 2020-01-14 14:53:42 +00:00
parent 1c71677527
commit 23331edff5
No known key found for this signature in database
GPG key ID: D1F18234B07BD6E2

View file

@ -2,13 +2,29 @@
with lib; with lib;
{ let
findObject = { kind, name }: filter (object:
object.kind == kind && object.metadata.name == name
) config.kubernetes.objects;
getObject = filter: head (findObject filter);
hasObject = { kind, name }: length (findObject { inherit kind name; }) == 1;
in {
imports = with kubenix.modules; [ test k8s legacy ]; imports = with kubenix.modules; [ test k8s legacy ];
test = { test = {
name = "legacy-crd"; name = "legacy-crd";
description = "Simple test tesing kubenix legacy integration with crds crd"; description = "Simple test tesing kubenix legacy integration with crds crd";
assertions = []; assertions = [{
message = "should define claim in module";
assertion =
hasObject {kind = "SecretClaim"; name = "secret-claim";};
} {
message = "should define claim in root";
assertion =
hasObject {kind = "SecretClaim"; name = "my-claim";};
}];
}; };
kubernetes.version = k8sVersion; kubernetes.version = k8sVersion;
@ -76,12 +92,11 @@ with lib;
}; };
}; };
kubernetes.modules.myclaim = { kubernetes.modules.secret-claim = {
module = "secret-claim";
configuration.path = "tokens/test"; configuration.path = "tokens/test";
}; };
kubernetes.customResources.secret-claims.propagated-claim = { kubernetes.customResources.secret-claims.my-claim = {
spec = { spec = {
path = "secrets/test2"; path = "secrets/test2";
}; };