googleapis / googleapis/google-cloud-go

httprelay: cannot use with `synctest`

Open
#12,716 0 comments 0 reactions 0 assignees View on GitHub
triage me
Dominant language
Go
Stars
4.5k
Forks
1.6k
Avg merge
1d 13h
Merged PRs (30d)
109

Description

## Client

httprelay

## Environment

macOS brew
go version go1.25.0 darwin/arm64

## Code and Dependencies

Using `httpreplay` inside `synctest` bubble.

## Expected behavior

Tests complete.

## Actual behavior

Tests hang until timeout.

## Additional context

Similar to https://github.com/googleapis/google-cloud-go/issues/12348

Something like this makes it work properly:

```
diff --git i/httpreplay/internal/proxy/record.go w/httpreplay/internal/proxy/record.go
index 4c1f5c6eba..a6fb94f691 100644
--- i/httpreplay/internal/proxy/record.go
+++ w/httpreplay/internal/proxy/record.go
@@ -51,6 +51,7 @@ type Proxy struct {
Initial []byte

mproxy *martian.Proxy
+ listener net.Listener
filename string // for log
logger *Logger // for recording only
ignoreHeaders map[string]bool // headers the user has asked to ignore
@@ -136,6 +137,7 @@ func (p *Proxy) start(port int) error {
return err
}
p.URL = &url.URL{Scheme: "http", Host: l.Addr().String()}
+ p.listener = l
go p.mproxy.Serve(l)
return nil
}
@@ -203,6 +205,7 @@ func (p *Proxy) IgnoreHeader(h string) {
// Close closes the proxy. If the proxy is recording, it also writes the log.
func (p *Proxy) Close() error {
p.mproxy.Close()
+ p.listener.Close()
if p.logger != nil {
return p.writeLog()
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.