hotfix(sessionresolver): prevent data race inside http3 (#809)
See https://github.com/ooni/probe/issues/2135#issuecomment-1149840579
This commit is contained in:
parent
fe29b432e0
commit
f1b8071c65
2 changed files with 7 additions and 41 deletions
|
|
@ -5,7 +5,6 @@ import (
|
|||
"errors"
|
||||
"io"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/ooni/probe-cli/v3/internal/model/mocks"
|
||||
|
|
@ -43,25 +42,3 @@ func TestTimeLimitedLookupFailure(t *testing.T) {
|
|||
t.Fatal("expected nil here")
|
||||
}
|
||||
}
|
||||
|
||||
func TestTimeLimitedLookupWillTimeout(t *testing.T) {
|
||||
done := make(chan bool)
|
||||
block := make(chan bool)
|
||||
re := &mocks.Resolver{
|
||||
MockLookupHost: func(ctx context.Context, domain string) ([]string, error) {
|
||||
defer close(done)
|
||||
<-block
|
||||
return nil, io.EOF
|
||||
},
|
||||
}
|
||||
ctx := context.Background()
|
||||
out, err := timeLimitedLookupWithTimeout(ctx, re, "dns.google", 10*time.Millisecond)
|
||||
if !errors.Is(err, context.DeadlineExceeded) {
|
||||
t.Fatal("not the error we expected", err)
|
||||
}
|
||||
if out != nil {
|
||||
t.Fatal("expected nil here")
|
||||
}
|
||||
close(block)
|
||||
<-done
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue