From 2f0ac27ec92840cab408e5f5a71d225be070cc0f Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sat, 21 Feb 2026 20:07:10 +0200 Subject: Verify harness handles workload crash/nonzero exit (task 343) Add crash scenario to ioworkload that exits non-zero, and a test verifying the harness returns a clear error mentioning 'workload', reports a valid PID, and returns no records. Amp-Thread-ID: https://ampcode.com/threads/T-019c815e-6fb6-714a-a4db-37522416ea9a Co-authored-by: Amp --- integrationtests/harness_test.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 integrationtests/harness_test.go (limited to 'integrationtests/harness_test.go') diff --git a/integrationtests/harness_test.go b/integrationtests/harness_test.go new file mode 100644 index 0000000..813e9d6 --- /dev/null +++ b/integrationtests/harness_test.go @@ -0,0 +1,23 @@ +package integrationtests + +import ( + "strings" + "testing" +) + +func TestWorkloadCrashReportsError(t *testing.T) { + h := newTestHarness(t) + result, pid, err := h.Run("crash", 5) + if err == nil { + t.Fatal("expected error from crashed workload, got nil") + } + if pid == 0 { + t.Fatal("expected non-zero PID from started workload") + } + if !strings.Contains(err.Error(), "workload") { + t.Errorf("error should mention workload, got: %v", err) + } + if len(result.Records) != 0 { + t.Errorf("expected no records from crashed workload, got %d", len(result.Records)) + } +} -- cgit v1.2.3