Skip to content

Commit 531fe28

Browse files
committed
Fix: windows test
1 parent da75cf8 commit 531fe28

3 files changed

Lines changed: 17 additions & 5 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
run: go test ./... -v
4040

4141
docker:
42-
name: Docker Build Stages
42+
name: Docker Build
4343
runs-on: ubuntu-latest
4444
steps:
4545
- name: Checkout

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![Go Report Card](https://goreportcard.com/badge/github.com/cavoq/DynamicProxy)](https://goreportcard.com/report/github.com/cavoq/DynamicProxy)
44

5-
DynamicProxy is a lightweight HTTP forward proxy designed for flexible upstream proxy switching based on request context. It was built to overcome limitations in environments where only a single static proxy can be configured like in [Mapsui](https://github.com/Mapsui/Mapsui) with [GDAL](https://gdal.org/) on Windows.
5+
DynamicProxy is a lightweight HTTP forward proxy designed for flexible upstream proxy switching based on request context. It was built to overcome limitations in environments where only a single static proxy can be configured - like in [Mapsui](https://github.com/Mapsui/Mapsui) with [GDAL](https://gdal.org/) on Windows.
66

77
This proxy enables both **internal** and **external** geo services to work seamlessly without reconfiguring or restarting your app. It dynamically routes requests through the appropriate upstream proxy or direct connection, based on rules you define.
88

integration_test.go

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import (
1212
"net/url"
1313
"os"
1414
"os/exec"
15+
"path/filepath"
16+
"runtime"
1517
"strings"
1618
"sync/atomic"
1719
"testing"
@@ -136,16 +138,26 @@ type dynamicProxy struct {
136138
func startDynamicProxy(t *testing.T, upstreamURL, exceptions string) *dynamicProxy {
137139
t.Helper()
138140

139-
if _, err := exec.LookPath("./dynamicproxy"); err != nil {
140-
build := exec.Command("go", "build", "-o", "dynamicproxy", "./cmd/main.go")
141+
binaryName := "dynamicproxy"
142+
if runtime.GOOS == "windows" {
143+
binaryName += ".exe"
144+
}
145+
binaryPath := filepath.Join(".", binaryName)
146+
absBinaryPath, err := filepath.Abs(binaryPath)
147+
if err != nil {
148+
t.Fatalf("failed to resolve binary path: %v", err)
149+
}
150+
151+
if _, err := os.Stat(absBinaryPath); err != nil {
152+
build := exec.Command("go", "build", "-o", binaryPath, "./cmd/main.go")
141153
build.Stdout = os.Stdout
142154
build.Stderr = os.Stderr
143155
if err := build.Run(); err != nil {
144156
t.Fatalf("failed to build dynamicproxy: %v", err)
145157
}
146158
}
147159

148-
cmd := exec.Command("./dynamicproxy")
160+
cmd := exec.Command(absBinaryPath)
149161
cmd.Env = append(os.Environ(),
150162
"UPSTREAM_PROXY="+upstreamURL,
151163
"PROXY_EXCEPTIONS="+exceptions,

0 commit comments

Comments
 (0)