nixosTests.haproxy: Port tests to python

This commit is contained in:
Christian Kampka 2019-12-15 17:01:03 +01:00
parent 0de0b6a281
commit 9fbb427f67
No known key found for this signature in database
GPG Key ID: B88E140DB4FE1AA5

View File

@ -1,4 +1,4 @@
import ./make-test.nix ({ pkgs, ...}: { import ./make-test-python.nix ({ pkgs, ...}: {
name = "haproxy"; name = "haproxy";
nodes = { nodes = {
machine = { ... }: { machine = { ... }: {
@ -33,11 +33,13 @@ import ./make-test.nix ({ pkgs, ...}: {
}; };
}; };
testScript = '' testScript = ''
startAll; start_all()
$machine->waitForUnit('multi-user.target'); machine.wait_for_unit("multi-user.target")
$machine->waitForUnit('haproxy.service'); machine.wait_for_unit("haproxy.service")
$machine->waitForUnit('httpd.service'); machine.wait_for_unit("httpd.service")
$machine->succeed('curl -k http://localhost:80/index.txt | grep "We are all good!"'); assert "We are all good!" in machine.succeed("curl -k http://localhost:80/index.txt")
$machine->succeed('curl -k http://localhost:80/metrics | grep haproxy_process_pool_allocated_bytes'); assert "haproxy_process_pool_allocated_bytes" in machine.succeed(
"curl -k http://localhost:80/metrics"
)
''; '';
}) })