Skip to content

Commit

Permalink
Update stellar/go dep to fix testLogWriter (#235)
Browse files Browse the repository at this point in the history
  • Loading branch information
tamirms authored Jun 28, 2024
1 parent ef78ce0 commit c231749
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 20 deletions.
21 changes: 2 additions & 19 deletions cmd/soroban-rpc/internal/integrationtest/infrastructure/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -398,32 +398,15 @@ func (i *Test) generateRPCConfigFile(rpcConfig rpcConfig) {

func newTestLogWriter(t *testing.T, prefix string) *testLogWriter {
tw := &testLogWriter{t: t, prefix: prefix}
t.Cleanup(func() {
tw.testDoneMx.Lock()
tw.testDone = true
tw.testDoneMx.Unlock()
})
return tw
}

type testLogWriter struct {
t *testing.T
prefix string
testDoneMx sync.RWMutex
testDone bool
t *testing.T
prefix string
}

func (tw *testLogWriter) Write(p []byte) (n int, err error) {
tw.testDoneMx.RLock()
if tw.testDone {
// Workaround for https://github.com/stellar/go/issues/5342
// and https://github.com/stellar/go/issues/5350, which causes a race condition
// in test logging
// TODO: remove once the tickets are fixed
tw.testDoneMx.RUnlock()
return len(p), nil
}
tw.testDoneMx.RUnlock()
all := strings.TrimSpace(string(p))
lines := strings.Split(all, "\n")
for _, l := range lines {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ require (
github.com/sirupsen/logrus v1.9.3
github.com/spf13/cobra v1.7.0
github.com/spf13/pflag v1.0.5
github.com/stellar/go v0.0.0-20240617183518-100dc4fa6043
github.com/stellar/go v0.0.0-20240628063057-b589529f102f
github.com/stretchr/testify v1.9.0
)

Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,8 @@ github.com/spf13/viper v1.17.0 h1:I5txKw7MJasPL/BrfkbA0Jyo/oELqVmux4pR/UxOMfI=
github.com/spf13/viper v1.17.0/go.mod h1:BmMMMLQXSbcHK6KAOiFLz0l5JHrU89OdIRHvsk0+yVI=
github.com/stellar/go v0.0.0-20240617183518-100dc4fa6043 h1:5UQzsvt9VtD3ijpzPtdW0/lXWCNgDs6GzmLUE8ZuWfk=
github.com/stellar/go v0.0.0-20240617183518-100dc4fa6043/go.mod h1:TuXKLL7WViqwrvpWno2I4UYGn2Ny9KZld1jUIN6fnK8=
github.com/stellar/go v0.0.0-20240628063057-b589529f102f h1:3W9JZJ0r87wy2M3wsACuJtKW/cNWXpfw5Jwyt89Am30=
github.com/stellar/go v0.0.0-20240628063057-b589529f102f/go.mod h1:4cVjIVyU8V1iSBEMGd41j22DAyBoz2SVL5TcrJPqePU=
github.com/stellar/go-xdr v0.0.0-20231122183749-b53fb00bcac2 h1:OzCVd0SV5qE3ZcDeSFCmOWLZfEWZ3Oe8KtmSOYKEVWE=
github.com/stellar/go-xdr v0.0.0-20231122183749-b53fb00bcac2/go.mod h1:yoxyU/M8nl9LKeWIoBrbDPQ7Cy+4jxRcWcOayZ4BMps=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
Expand Down

0 comments on commit c231749

Please sign in to comment.