summaryrefslogtreecommitdiff
path: root/internal/ior_setup_test.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-03-10 07:57:31 +0200
committerPaul Buetow <paul@buetow.org>2026-03-10 07:57:31 +0200
commite9bdf85b11e9c75f19721384f1c1b34b0f2f4ea0 (patch)
tree50a25a038c5b8abdd4f7a88b0e988257acb8f34c /internal/ior_setup_test.go
parent0930b4c51191ec01cabc03779ef296153ed7f08a (diff)
internal: add context to BPF setup failures (task 416)
Diffstat (limited to 'internal/ior_setup_test.go')
-rw-r--r--internal/ior_setup_test.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/internal/ior_setup_test.go b/internal/ior_setup_test.go
new file mode 100644
index 0000000..9c8b1b3
--- /dev/null
+++ b/internal/ior_setup_test.go
@@ -0,0 +1,27 @@
+package internal
+
+import (
+ "errors"
+ "testing"
+)
+
+func TestSetupBPFModuleErrorWrapsStage(t *testing.T) {
+ cause := errors.New("boom")
+
+ err := setupBPFModuleError("load object", cause)
+ if err == nil {
+ t.Fatalf("expected wrapped error")
+ }
+ if got, want := err.Error(), "setup BPF module: load object: boom"; got != want {
+ t.Fatalf("wrapped error = %q, want %q", got, want)
+ }
+ if !errors.Is(err, cause) {
+ t.Fatalf("expected wrapped error to retain original cause")
+ }
+}
+
+func TestSetupBPFModuleErrorNil(t *testing.T) {
+ if err := setupBPFModuleError("attach probes", nil); err != nil {
+ t.Fatalf("expected nil error passthrough, got %v", err)
+ }
+}