blocky/resolver/resolver_suite_test.go

45 lines
771 B
Go
Raw Permalink Normal View History

package resolver
2020-05-04 22:20:13 +02:00
import (
"context"
2020-05-04 22:20:13 +02:00
"testing"
"time"
2020-05-04 22:20:13 +02:00
"github.com/0xERR0R/blocky/config"
"github.com/0xERR0R/blocky/log"
"github.com/go-redis/redis/v8"
2021-08-25 22:06:34 +02:00
2022-03-03 11:27:27 +01:00
. "github.com/onsi/ginkgo/v2"
2020-05-04 22:20:13 +02:00
. "github.com/onsi/gomega"
)
const (
timeout = 50 * time.Millisecond
)
var defaultUpstreamsConfig config.Upstreams
func init() {
log.Silence()
redis.SetLogger(NoLogs{})
var err error
defaultUpstreamsConfig, err = config.WithDefaults[config.Upstreams]()
if err != nil {
panic(err)
}
// Shorter timeout for tests
defaultUpstreamsConfig.Timeout = config.Duration(timeout)
}
func TestResolver(t *testing.T) {
2020-05-04 22:20:13 +02:00
RegisterFailHandler(Fail)
RunSpecs(t, "Resolver Suite")
}
type NoLogs struct{}
func (l NoLogs) Printf(_ context.Context, _ string, _ ...interface{}) {}