summaryrefslogtreecommitdiff
path: root/integrationtests
diff options
context:
space:
mode:
Diffstat (limited to 'integrationtests')
-rw-r--r--integrationtests/cmd/ioworkload/scenarios.go7
-rw-r--r--integrationtests/harness_test.go23
2 files changed, 30 insertions, 0 deletions
diff --git a/integrationtests/cmd/ioworkload/scenarios.go b/integrationtests/cmd/ioworkload/scenarios.go
index 06e202d..1ca7328 100644
--- a/integrationtests/cmd/ioworkload/scenarios.go
+++ b/integrationtests/cmd/ioworkload/scenarios.go
@@ -11,6 +11,7 @@ import (
// scenarios maps scenario names to their execution functions.
var scenarios = map[string]func() error{
+ "crash": crash,
"open-basic": openBasic,
"open-creat": openCreat,
"open-by-handle-at": openByHandleAt,
@@ -1576,3 +1577,9 @@ func ioUringSetupRing(entries uint32) (int, error) {
}
return int(fd), nil
}
+
+// crash simulates a workload that fails with a non-zero exit code.
+// Used to verify the test harness handles workload failures gracefully.
+func crash() error {
+ return fmt.Errorf("intentional crash for testing")
+}
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))
+ }
+}