mirror of
https://github.com/TECHNOFAB11/kubenix.git
synced 2026-02-02 17:35:10 +01:00
feat: refactor tests
This commit is contained in:
parent
0d68a401f0
commit
b4c4f17cc9
10 changed files with 3 additions and 2 deletions
34
tests/k8s/deployment.nix
Normal file
34
tests/k8s/deployment.nix
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
{ config, test, kubenix, ... }:
|
||||
|
||||
let
|
||||
cfg = config.kubernetes.api.deployments.nginx;
|
||||
in {
|
||||
imports = [
|
||||
kubenix.k8s
|
||||
];
|
||||
|
||||
test = {
|
||||
name = "k8s/deployment/simple";
|
||||
description = "Simple k8s testing a simple deployment";
|
||||
assertions = [{
|
||||
message = "should have correct apiVersion and kind set";
|
||||
assertion = cfg.apiVersion == "apps/v1" && cfg.kind == "Deployment";
|
||||
} {
|
||||
message = "should have replicas set";
|
||||
assertion = cfg.spec.replicas == 10;
|
||||
}];
|
||||
};
|
||||
|
||||
kubernetes.api.deployments.nginx = {
|
||||
spec = {
|
||||
replicas = 10;
|
||||
selector.matchLabels.app = "nginx";
|
||||
template.metadata.labels.app = "nginx";
|
||||
template.spec = {
|
||||
containers.nginx = {
|
||||
image = "nginx";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue