refactor(sessionresolver): adapt to changing network conditions (#238)

* feat(sessionresolver): try many and use what works

* fix(sessionresolver): make sure we can use quic

* fix: the config struct is unnecessary

* fix: make kvstore optional

* feat: write simple integration test

* feat: start adding tests

* feat: continue writing tests

* fix(sessionresolver): add more unit tests

* fix(sessionresolver): finish adding tests

* refactor(sessionresolver): changes after code review
This commit is contained in:
Simone Basso 2021-03-03 11:28:39 +01:00 committed by GitHub
commit 034db78f94
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 1260 additions and 66 deletions

View file

@ -0,0 +1,24 @@
package sessionresolver
import (
"errors"
"io"
"testing"
"github.com/google/go-cmp/cmp"
)
func TestErrWrapper(t *testing.T) {
ew := &errwrapper{
error: io.EOF,
URL: "https://dns.quad9.net/dns-query",
}
o := ew.Error()
expect := "<https://dns.quad9.net/dns-query> EOF"
if diff := cmp.Diff(expect, o); diff != "" {
t.Fatal(diff)
}
if !errors.Is(ew, io.EOF) {
t.Fatal("not the sub-error we expected")
}
}