nixosTests.etcd: handleTest -> runTest

This commit is contained in:
Sizhe Zhao 2025-06-07 21:27:39 +08:00
parent 5df085c57a
commit 969bed3f90
No known key found for this signature in database
GPG Key ID: ED1807251A7DA08F
2 changed files with 19 additions and 27 deletions

View File

@ -473,7 +473,7 @@ in
activation-etc-overlay-mutable = runTest ./activation/etc-overlay-mutable.nix;
activation-etc-overlay-immutable = runTest ./activation/etc-overlay-immutable.nix;
activation-perlless = runTest ./activation/perlless.nix;
etcd = handleTestOn [ "aarch64-linux" "x86_64-linux" ] ./etcd/etcd.nix { };
etcd = runTestOn [ "aarch64-linux" "x86_64-linux" ] ./etcd/etcd.nix;
etcd-cluster = handleTestOn [ "aarch64-linux" "x86_64-linux" ] ./etcd/etcd-cluster.nix { };
etebase-server = runTest ./etebase-server.nix;
etesync-dav = runTest ./etesync-dav.nix;

View File

@ -1,30 +1,22 @@
# This test runs simple etcd node
import ../make-test-python.nix (
{ pkgs, ... }:
{
name = "etcd";
meta = with pkgs.lib.maintainers; {
maintainers = [ offline ];
};
{ lib, ... }:
{
name = "etcd";
meta.maintainers = with lib.maintainers; [ offline ];
nodes = {
node =
{ ... }:
{
services.etcd.enable = true;
};
};
nodes.node = {
services.etcd.enable = true;
};
testScript = ''
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")
testScript = ''
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'")
'';
}
)
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'")
'';
}