mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-26 00:43:20 +00:00
etcd.nix: minor fixes
Adds explicit network configuration for etcd service Waits for etcd to be fully healthy before running tests Makes endpoint configuration explicit in etcdctl commands
This commit is contained in:
parent
db11f98934
commit
3270e162e6
@ -1,15 +1,22 @@
|
||||
# This test runs simple etcd node
|
||||
|
||||
import ../make-test-python.nix ({ pkgs, ... } : {
|
||||
name = "etcd";
|
||||
|
||||
meta = with pkgs.lib.maintainers; {
|
||||
maintainers = [ offline ];
|
||||
};
|
||||
|
||||
nodes = {
|
||||
node = { ... }: {
|
||||
services.etcd.enable = true;
|
||||
services.etcd = {
|
||||
enable = true;
|
||||
# Ensure etcd is ready to accept connections
|
||||
extraConf = {
|
||||
"initial-advertise-peer-urls" = "http://localhost:2380";
|
||||
"listen-peer-urls" = "http://localhost:2380";
|
||||
"listen-client-urls" = "http://localhost:2379";
|
||||
"advertise-client-urls" = "http://localhost:2379";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@ -17,9 +24,11 @@ import ../make-test-python.nix ({ pkgs, ... } : {
|
||||
with subtest("should start etcd node"):
|
||||
node.start()
|
||||
node.wait_for_unit("etcd.service")
|
||||
# Add additional wait for actual readiness
|
||||
node.wait_until_succeeds("etcdctl endpoint health")
|
||||
|
||||
with subtest("should write and read some values to etcd"):
|
||||
node.succeed("etcdctl put /foo/bar 'Hello world'")
|
||||
node.succeed("etcdctl get /foo/bar | grep 'Hello world'")
|
||||
node.succeed("etcdctl --endpoints=http://localhost:2379 put /foo/bar 'Hello world'")
|
||||
node.succeed("etcdctl --endpoints=http://localhost:2379 get /foo/bar | grep 'Hello world'")
|
||||
'';
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user