refactor: merge dnsx and errorsx into netxlite (#517)
When preparing a tutorial for netxlite, I figured it is easier to tell people "hey, this is the package you should use for all low-level networking stuff" rather than introducing people to a set of packages working together where some piece of functionality is here and some other piece is there. Part of https://github.com/ooni/probe/issues/1591
This commit is contained in:
parent
de130d249c
commit
6d3a4f1db8
169 changed files with 575 additions and 671 deletions
|
|
@ -5,7 +5,6 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/ooni/probe-cli/v3/internal/netxlite/errorsx"
|
||||
)
|
||||
|
||||
func TestQuirkReduceErrors(t *testing.T) {
|
||||
|
|
@ -35,19 +34,19 @@ func TestQuirkReduceErrors(t *testing.T) {
|
|||
|
||||
t.Run("multiple errors with meaningful ones", func(t *testing.T) {
|
||||
err1 := errors.New("mocked error #1")
|
||||
err2 := errorsx.NewErrWrapper(
|
||||
errorsx.ClassifyGenericError,
|
||||
errorsx.CloseOperation,
|
||||
err2 := NewErrWrapper(
|
||||
ClassifyGenericError,
|
||||
CloseOperation,
|
||||
errors.New("antani"),
|
||||
)
|
||||
err3 := errorsx.NewErrWrapper(
|
||||
errorsx.ClassifyGenericError,
|
||||
errorsx.CloseOperation,
|
||||
errorsx.ECONNREFUSED,
|
||||
err3 := NewErrWrapper(
|
||||
ClassifyGenericError,
|
||||
CloseOperation,
|
||||
ECONNREFUSED,
|
||||
)
|
||||
err4 := errors.New("mocked error #3")
|
||||
result := quirkReduceErrors([]error{err1, err2, err3, err4})
|
||||
if result.Error() != errorsx.FailureConnectionRefused {
|
||||
if result.Error() != FailureConnectionRefused {
|
||||
t.Fatal("wrong result")
|
||||
}
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in a new issue