mirror of
https://github.com/TECHNOFAB11/kubenix.git
synced 2025-12-12 08:00:06 +01:00
feat(test,k8s): add crd tests
This commit is contained in:
parent
bd6741fab1
commit
fde2d5557c
4 changed files with 79 additions and 1 deletions
|
|
@ -152,11 +152,12 @@ in {
|
|||
description = mkOption {
|
||||
description = "CRD description";
|
||||
type = types.str;
|
||||
default = "";
|
||||
};
|
||||
|
||||
module = mkOption {
|
||||
description = "CRD module";
|
||||
default = {};
|
||||
default = types.unspecified;
|
||||
};
|
||||
};
|
||||
}));
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ with lib;
|
|||
testing.tests = [
|
||||
./k8s/simple.nix
|
||||
./k8s/deployment.nix
|
||||
./k8s/crd.nix
|
||||
./k8s/1.13/crd.nix
|
||||
./submodules/simple.nix
|
||||
];
|
||||
}
|
||||
|
|
|
|||
40
test/k8s/1.13/crd.nix
Normal file
40
test/k8s/1.13/crd.nix
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
{ config, lib, kubenix, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.kubernetes.api.customresourcedefinitions.crontabs;
|
||||
in {
|
||||
imports = [
|
||||
kubenix.k8s
|
||||
];
|
||||
|
||||
test = {
|
||||
name = "k8s/1.13/crd";
|
||||
description = "Simple test tesing CRD for k8s 1.13";
|
||||
enable = builtins.compareVersions config.kubernetes.version "1.13" >= 0;
|
||||
assertions = [{
|
||||
message = "should have versions set";
|
||||
assertion = (head cfg.spec.versions).name == "v1";
|
||||
}];
|
||||
};
|
||||
|
||||
kubernetes.api.customresourcedefinitions.crontabs = {
|
||||
metadata.name = "crontabs.stable.example.com";
|
||||
spec = {
|
||||
group = "stable.example.com";
|
||||
versions = [{
|
||||
name = "v1";
|
||||
served = true;
|
||||
storage = true;
|
||||
}];
|
||||
scope = "Namespaced";
|
||||
names = {
|
||||
plural = "crontabs";
|
||||
singular = "crontab";
|
||||
kind = "CronTab";
|
||||
shortNames = ["ct"];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
35
test/k8s/crd.nix
Normal file
35
test/k8s/crd.nix
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
{ config, lib, kubenix, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.kubernetes.api.customresourcedefinitions.crontabs;
|
||||
in {
|
||||
imports = [
|
||||
kubenix.k8s
|
||||
];
|
||||
|
||||
test = {
|
||||
name = "k8s/crd";
|
||||
description = "Simple test tesing CRD";
|
||||
assertions = [{
|
||||
message = "should have group set";
|
||||
assertion = cfg.spec.group == "stable.example.com";
|
||||
}];
|
||||
};
|
||||
|
||||
kubernetes.api.customresourcedefinitions.crontabs = {
|
||||
metadata.name = "crontabs.stable.example.com";
|
||||
spec = {
|
||||
group = "stable.example.com";
|
||||
version = "v1";
|
||||
scope = "Namespaced";
|
||||
names = {
|
||||
plural = "crontabs";
|
||||
singular = "crontab";
|
||||
kind = "CronTab";
|
||||
shortNames = ["ct"];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue