From 42199dfa76413d4c31f8afb0ebb0ec1761a7ecb1 Mon Sep 17 00:00:00 2001 From: atlas Date: Sat, 28 Nov 2026 11:03:34 +0100 Subject: [PATCH] find the store's files without closing a pipe on find MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `find … | head -1` under the driver's pipefail fails when find has another file to write after head has exited: "find: write error: Broken pipe", exit 1. The metrics store's directory now holds enough files for that. find stops itself with -print -quit. --- nix/vm-tests/k8s-services.nix | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/nix/vm-tests/k8s-services.nix b/nix/vm-tests/k8s-services.nix index 04773ddc4..f89959e9b 100644 --- a/nix/vm-tests/k8s-services.nix +++ b/nix/vm-tests/k8s-services.nix @@ -502,7 +502,7 @@ pkgs.testers.runNixOSTest { fi kill -TERM "$pid" wait "$pid" || true - test -n "$(find ${vlDir} -type f | head -1)" + test -n "$(find ${vlDir} -type f -print -quit)" ''; }; @@ -565,7 +565,7 @@ pkgs.testers.runNixOSTest { fi kill -TERM "$pid" wait "$pid" || true - test -n "$(find ${vmDir} -type f | head -1)" + test -n "$(find ${vmDir} -type f -print -quit)" ''; }; @@ -1166,7 +1166,7 @@ pkgs.testers.runNixOSTest { pvc = json.loads(kube(machine, f"get pvc {VL}-store -o json")) assert pvc["status"]["phase"] == "Bound" and pvc["spec"]["volumeName"] == pv["metadata"]["name"], pvc assert machine.succeed(f"stat -c %g {VL_DIR}").strip() == "65532" - assert machine.succeed(f"find {VL_DIR} -type f -user ${legacyUser} | head -1").strip() != "" + assert machine.succeed(f"find {VL_DIR} -type f -user ${legacyUser} -print -quit").strip() != "" assert machine.succeed(f"kubectl -n {NS} get pods {vl_pod} -o jsonpath='{{.status.containerStatuses[0].restartCount}}'").strip() == "0" def vl_request(path: str, token: str | None, *args: str) -> tuple[int, str]: @@ -1528,7 +1528,7 @@ pkgs.testers.runNixOSTest { pvc = json.loads(kube(machine, f"get pvc {VM}-store -o json")) assert pvc["status"]["phase"] == "Bound" and pvc["spec"]["volumeName"] == pv["metadata"]["name"], pvc assert machine.succeed(f"stat -c %g {VM_DIR}").strip() == "65532" - assert machine.succeed(f"find {VM_DIR} -type f -user ${legacyVmUser} | head -1").strip() != "" + assert machine.succeed(f"find {VM_DIR} -type f -user ${legacyVmUser} -print -quit").strip() != "" status = json.loads(kube(machine, f"get pod {vm_pod} -o json")) assert status["spec"]["containers"][0]["startupProbe"]["failureThreshold"] == 60, status["spec"] container = status["status"]["containerStatuses"][0] @@ -1812,7 +1812,7 @@ pkgs.testers.runNixOSTest { pvc = json.loads(kube(machine, f"get pvc {GRAFANA}-store -o json")) assert pvc["status"]["phase"] == "Bound" and pvc["spec"]["volumeName"] == pv["metadata"]["name"], pvc assert machine.succeed(f"stat -c %g {GRAFANA_DIR}").strip() == "65532" - assert machine.succeed(f"find {GRAFANA_DIR} -name grafana.db -user ${legacyGrafanaUser} | head -1").strip() != "" + assert machine.succeed(f"find {GRAFANA_DIR} -name grafana.db -user ${legacyGrafanaUser} -print -quit").strip() != "" status = json.loads(kube(machine, f"get pod {grafana_pod} -o json")) main = next(c for c in status["spec"]["containers"] if c["name"] == GRAFANA) assert main["startupProbe"]["failureThreshold"] == 30, main