summaryrefslogtreecommitdiff
path: root/tests/e2e/test_helpers.go
diff options
context:
space:
mode:
Diffstat (limited to 'tests/e2e/test_helpers.go')
-rw-r--r--tests/e2e/test_helpers.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/e2e/test_helpers.go b/tests/e2e/test_helpers.go
index 6d65011..93e851c 100644
--- a/tests/e2e/test_helpers.go
+++ b/tests/e2e/test_helpers.go
@@ -4,6 +4,7 @@ import (
"fmt"
"os"
"strings"
+ "testing"
)
// GetBinaryPath resolves the path to the wg-wrap binary.
@@ -21,6 +22,16 @@ func GetBinaryPath() (string, error) {
return path, nil
}
+// EnsureBinary returns the path to the wg-wrap binary or skips the test if it's not available.
+func EnsureBinary(t *testing.T) string {
+ t.Helper()
+ bin, err := GetBinaryPath()
+ if err != nil {
+ t.Skipf("skipping test: %v", err)
+ }
+ return bin
+}
+
// SetEnvOverrides returns a new slice of environment variables with the provided overrides applied.
// It ensures that overriding an existing variable replaces it rather than appending it.
func SetEnvOverrides(overrides map[string]string) []string {