2019-03-07 23:24:28 +01:00
|
|
|
{
|
2022-04-02 12:40:35 -07:00
|
|
|
lib,
|
|
|
|
|
pkgs,
|
|
|
|
|
kubenix,
|
|
|
|
|
test,
|
|
|
|
|
...
|
|
|
|
|
}:
|
|
|
|
|
with lib; {
|
|
|
|
|
imports = [kubenix.modules.test ./module.nix];
|
2019-03-07 23:24:28 +01:00
|
|
|
|
|
|
|
|
test = {
|
|
|
|
|
name = "nginx-deployment";
|
|
|
|
|
description = "Test testing nginx deployment";
|
2021-05-13 22:58:11 -04:00
|
|
|
script = ''
|
2021-05-31 21:45:22 -05:00
|
|
|
@pytest.mark.applymanifest('${test.kubernetes.resultYAML}')
|
2021-05-13 22:58:11 -04:00
|
|
|
def test_nginx_deployment(kube):
|
|
|
|
|
"""Tests whether nginx deployment gets successfully created"""
|
2019-03-07 23:24:28 +01:00
|
|
|
|
2021-05-13 22:58:11 -04:00
|
|
|
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
|
2019-03-07 23:24:28 +01:00
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
}
|