From 2e4fac6dfdbc71b35708aef46c546b2dd2ae38b4 Mon Sep 17 00:00:00 2001 From: Sizhe Zhao Date: Sat, 7 Jun 2025 18:50:53 +0800 Subject: [PATCH] nixosTests.cadvisor: handleTest -> runTest --- nixos/tests/all-tests.nix | 2 +- nixos/tests/cadvisor.nix | 60 ++++++++++++++++++--------------------- 2 files changed, 28 insertions(+), 34 deletions(-) diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index a800736e4b8d..06500d90ec97 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -283,7 +283,7 @@ in buildkite-agents = runTest ./buildkite-agents.nix; c2fmzq = runTest ./c2fmzq.nix; caddy = runTest ./caddy.nix; - cadvisor = handleTestOn [ "x86_64-linux" ] ./cadvisor.nix { }; + cadvisor = runTestOn [ "x86_64-linux" ] ./cadvisor.nix; cage = runTest ./cage.nix; cagebreak = runTest ./cagebreak.nix; calibre-web = runTest ./calibre-web.nix; diff --git a/nixos/tests/cadvisor.nix b/nixos/tests/cadvisor.nix index d558bc3007ec..f63f900362d5 100644 --- a/nixos/tests/cadvisor.nix +++ b/nixos/tests/cadvisor.nix @@ -1,39 +1,33 @@ -import ./make-test-python.nix ( - { lib, pkgs, ... }: - { - name = "cadvisor"; - meta.maintainers = with lib.maintainers; [ offline ]; +{ lib, ... }: +{ + name = "cadvisor"; + meta.maintainers = with lib.maintainers; [ offline ]; - nodes = { - machine = - { ... }: - { - services.cadvisor.enable = true; - }; - - influxdb = - { lib, ... }: - { - services.cadvisor.enable = true; - services.cadvisor.storageDriver = "influxdb"; - services.influxdb.enable = true; - }; + nodes = { + machine = { + services.cadvisor.enable = true; }; - testScript = '' - start_all() - machine.wait_for_unit("cadvisor.service") - machine.succeed("curl -f http://localhost:8080/containers/") + influxdb = { + services.cadvisor.enable = true; + services.cadvisor.storageDriver = "influxdb"; + services.influxdb.enable = true; + }; + }; - influxdb.wait_for_unit("influxdb.service") + testScript = '' + start_all() + machine.wait_for_unit("cadvisor.service") + machine.succeed("curl -f http://localhost:8080/containers/") - # create influxdb database - influxdb.succeed( - 'curl -f -XPOST http://localhost:8086/query --data-urlencode "q=CREATE DATABASE root"' - ) + influxdb.wait_for_unit("influxdb.service") - influxdb.wait_for_unit("cadvisor.service") - influxdb.succeed("curl -f http://localhost:8080/containers/") - ''; - } -) + # create influxdb database + influxdb.succeed( + 'curl -f -XPOST http://localhost:8086/query --data-urlencode "q=CREATE DATABASE root"' + ) + + influxdb.wait_for_unit("cadvisor.service") + influxdb.succeed("curl -f http://localhost:8080/containers/") + ''; +}