summaryrefslogtreecommitdiff
path: root/tests/e2e/test_helpers.go
blob: 0ae83aad930af00cc7110f4d0c42fbf5e93cbac8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package e2e

import (
	"fmt"
	"os"
)

// GetBinaryPath resolves the path to the wg-wrap binary.
// It prioritizes the WG_WRAP_BIN environment variable.
func GetBinaryPath() (string, error) {
	path := os.Getenv("WG_WRAP_BIN")
	if path == "" {
		return "", fmt.Errorf("WG_WRAP_BIN environment variable not set")
	}

	if _, err := os.Stat(path); err != nil {
		return "", fmt.Errorf("binary not found at path %s: %w", path, err)
	}

	return path, nil
}