2016-08-25 14:41:47 +02:00
|
|
|
# This test runs simple etcd node
|
2024-02-14 11:45:02 -03:00
|
|
|
import ../make-test-python.nix (
|
|
|
|
{ pkgs, ... }:
|
|
|
|
{
|
2016-08-24 20:11:39 +02:00
|
|
|
name = "etcd";
|
2021-01-10 20:08:30 +01:00
|
|
|
meta = with pkgs.lib.maintainers; {
|
2016-08-24 20:11:39 +02:00
|
|
|
maintainers = [ offline ];
|
|
|
|
};
|
2014-11-15 16:27:27 +01:00
|
|
|
|
2016-08-24 20:11:39 +02:00
|
|
|
nodes = {
|
2018-07-20 20:56:59 +00:00
|
|
|
node =
|
|
|
|
{ ... }:
|
|
|
|
{
|
2024-10-31 18:21:05 +05:30
|
|
|
services.etcd.enable = true;
|
2024-12-10 20:29:24 +01:00
|
|
|
};
|
2014-11-15 16:27:27 +01:00
|
|
|
};
|
|
|
|
|
2016-08-24 20:11:39 +02:00
|
|
|
testScript = ''
|
2019-11-24 01:38:24 +01:00
|
|
|
with subtest("should start etcd node"):
|
|
|
|
node.start()
|
|
|
|
node.wait_for_unit("etcd.service")
|
2024-10-24 18:20:21 +05:30
|
|
|
# Add additional wait for actual readiness
|
|
|
|
node.wait_until_succeeds("etcdctl endpoint health")
|
2014-11-15 16:27:27 +01:00
|
|
|
|
2019-11-24 01:38:24 +01:00
|
|
|
with subtest("should write and read some values to etcd"):
|
2024-10-31 18:21:05 +05:30
|
|
|
node.succeed("etcdctl put /foo/bar 'Hello world'")
|
|
|
|
node.succeed("etcdctl get /foo/bar | grep 'Hello world'")
|
2014-11-15 16:27:27 +01:00
|
|
|
'';
|
2015-07-12 12:09:40 +02:00
|
|
|
}
|
|
|
|
)
|