mirror of
https://github.com/TECHNOFAB11/kubenix.git
synced 2025-12-13 08:30:05 +01:00
adapt remaining tests to kubetest
This commit is contained in:
parent
8a20c93b21
commit
7b057d8c0f
5 changed files with 53 additions and 112 deletions
|
|
@ -8,13 +8,23 @@ with lib;
|
|||
test = {
|
||||
name = "nginx-deployment";
|
||||
description = "Test testing nginx deployment";
|
||||
testScript = ''
|
||||
kube.wait_until_succeeds("docker load --input='${config.docker.images.nginx.image}'")
|
||||
kube.wait_until_succeeds("kubectl apply -f ${config.kubernetes.result}")
|
||||
script = ''
|
||||
@pytest.mark.applymanifest('${config.kubernetes.resultYAML}')
|
||||
def test_nginx_deployment(kube):
|
||||
"""Tests whether nginx deployment gets successfully created"""
|
||||
|
||||
kube.succeed("kubectl get deployment | grep -i nginx")
|
||||
kube.wait_until_succeeds("kubectl get deployment -o go-template nginx --template={{.status.readyReplicas}} | grep 10")
|
||||
kube.wait_until_succeeds({pkgs.curl}/bin/curl http://nginx.default.svc.cluster.local | grep -i hello")
|
||||
kube.wait_for_registered(timeout=30)
|
||||
|
||||
deployments = kube.get_deployments()
|
||||
nginx_deploy = deployments.get('nginx')
|
||||
assert nginx_deploy is not None
|
||||
|
||||
status = nginx_deploy.status()
|
||||
assert status.readyReplicas == 10
|
||||
|
||||
# TODO: implement those kind of checks from the host machine into the cluster
|
||||
# via port forwarding, prepare all runtimes accordingly
|
||||
# ${pkgs.curl}/bin/curl http://nginx.default.svc.cluster.local | grep -i hello
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue