fix: Use correct bd binary path for Windows tests
- Add getBDPath() helper to return bd.exe on Windows, bd on Unix - Fixes TestHashIDs_MultiCloneConverge and TestHashIDs_IdenticalContentDedup on Windows CI
This commit is contained in:
@@ -5,22 +5,31 @@ import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
// getBDPath returns the correct path to the bd binary for the current OS
|
||||
func getBDPath() string {
|
||||
if runtime.GOOS == "windows" {
|
||||
return "./bd.exe"
|
||||
}
|
||||
return "./bd"
|
||||
}
|
||||
|
||||
// TestHashIDs_MultiCloneConverge verifies that hash-based IDs work correctly
|
||||
// across multiple clones creating different issues. With hash IDs, each unique
|
||||
// issue gets a unique ID, so no collision resolution is needed.
|
||||
func TestHashIDs_MultiCloneConverge(t *testing.T) {
|
||||
tmpDir := t.TempDir()
|
||||
|
||||
bdPath, err := filepath.Abs("./bd")
|
||||
bdPath, err := filepath.Abs(getBDPath())
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to get bd path: %v", err)
|
||||
}
|
||||
if _, err := os.Stat(bdPath); err != nil {
|
||||
t.Fatalf("bd binary not found at %s - run 'go build -o bd ./cmd/bd' first", bdPath)
|
||||
t.Fatalf("bd binary not found at %s - run 'go build -v ./cmd/bd' first", bdPath)
|
||||
}
|
||||
|
||||
// Setup remote and 3 clones
|
||||
@@ -79,12 +88,12 @@ func TestHashIDs_MultiCloneConverge(t *testing.T) {
|
||||
func TestHashIDs_IdenticalContentDedup(t *testing.T) {
|
||||
tmpDir := t.TempDir()
|
||||
|
||||
bdPath, err := filepath.Abs("./bd")
|
||||
bdPath, err := filepath.Abs(getBDPath())
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to get bd path: %v", err)
|
||||
}
|
||||
if _, err := os.Stat(bdPath); err != nil {
|
||||
t.Fatalf("bd binary not found at %s - run 'go build -o bd ./cmd/bd' first", bdPath)
|
||||
t.Fatalf("bd binary not found at %s - run 'go build -v ./cmd/bd' first", bdPath)
|
||||
}
|
||||
|
||||
// Setup remote and 2 clones
|
||||
|
||||
Reference in New Issue
Block a user