summaryrefslogtreecommitdiff
path: root/internal/ior_setup_test.go
diff options
context:
space:
mode:
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)
+ }
+}