tests: reduce timeouts and iterations (#1175)
This reduces the time it takes to run the test. Shorter timeouts on clients to avoid awaiting for the detault timeouts. It's also reduces the iterations in some test functions, this doesn't seem to impact the tests indicating those numbers where random to begin with. Use shorter crypto keys, as we don't need to strength in tests. Stop using Google Public DNS and other remotes in tests as well: it's faster, keeps things local and avoids spilling info to Google. This brings the test duration down from ~8s to ~2s on my machine, a 4x reduction. ~~~ PASS ok github.com/miekg/dns 2.046s Switched to branch 'master' Your branch is up-to-date with 'origin/master'. PASS ok github.com/miekg/dns 7.915s ~~~ Signed-off-by: Miek Gieben <miek@miek.nl>
This commit is contained in:
parent
10e0aeedbe
commit
3b0ffe413f
@ -168,7 +168,7 @@ func Test65534(t *testing.T) {
|
||||
key.Flags = 256
|
||||
key.Protocol = 3
|
||||
key.Algorithm = RSASHA256
|
||||
privkey, _ := key.Generate(1024)
|
||||
privkey, _ := key.Generate(512)
|
||||
|
||||
sig := new(RRSIG)
|
||||
sig.Hdr = RR_Header{"miek.nl.", TypeRRSIG, ClassINET, 14400, 0}
|
||||
@ -251,7 +251,7 @@ func TestKeyRSA(t *testing.T) {
|
||||
key.Flags = 256
|
||||
key.Protocol = 3
|
||||
key.Algorithm = RSASHA256
|
||||
priv, _ := key.Generate(2048)
|
||||
priv, _ := key.Generate(512)
|
||||
|
||||
soa := new(SOA)
|
||||
soa.Hdr = RR_Header{"miek.nl.", TypeSOA, ClassINET, 14400, 0}
|
||||
|
@ -7,24 +7,6 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestTCPRtt(t *testing.T) {
|
||||
m := new(Msg)
|
||||
m.RecursionDesired = true
|
||||
m.SetQuestion("example.org.", TypeA)
|
||||
|
||||
c := &Client{}
|
||||
for _, proto := range []string{"udp", "tcp"} {
|
||||
c.Net = proto
|
||||
_, rtt, err := c.Exchange(m, "8.8.4.4:53")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if rtt == 0 {
|
||||
t.Fatalf("expecting non zero rtt %s, got zero", c.Net)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestNSEC3MissingSalt(t *testing.T) {
|
||||
rr := testRR("ji6neoaepv8b5o6k4ev33abha8ht9fgc.example. NSEC3 1 1 12 aabbccdd K8UDEMVP1J2F7EG6JEBPS17VP3N8I58H")
|
||||
m := new(Msg)
|
||||
|
@ -1312,8 +1312,8 @@ func TestNewPrivateKey(t *testing.T) {
|
||||
algorithms := []algorithm{
|
||||
{ECDSAP256SHA256, 256},
|
||||
{ECDSAP384SHA384, 384},
|
||||
{RSASHA1, 1024},
|
||||
{RSASHA256, 2048},
|
||||
{RSASHA1, 512},
|
||||
{RSASHA256, 512},
|
||||
{ED25519, 256},
|
||||
}
|
||||
|
||||
|
@ -1,19 +0,0 @@
|
||||
package dns
|
||||
|
||||
import "testing"
|
||||
|
||||
const LinodeAddr = "176.58.119.54:53"
|
||||
|
||||
func TestClientRemote(t *testing.T) {
|
||||
m := new(Msg)
|
||||
m.SetQuestion("go.dns.miek.nl.", TypeTXT)
|
||||
|
||||
c := new(Client)
|
||||
r, _, err := c.Exchange(m, LinodeAddr)
|
||||
if err != nil {
|
||||
t.Errorf("failed to exchange: %v", err)
|
||||
}
|
||||
if r != nil && r.Rcode != RcodeSuccess {
|
||||
t.Errorf("failed to get an valid answer\n%v", r)
|
||||
}
|
||||
}
|
@ -635,7 +635,8 @@ func TestServingResponse(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal("failed to exchange", err)
|
||||
}
|
||||
m.Response = true
|
||||
m.Response = true // this holds up the reply, set short read time out to avoid waiting too long
|
||||
c.ReadTimeout = 100 * time.Millisecond
|
||||
_, _, err = c.Exchange(m, addrstr)
|
||||
if err == nil {
|
||||
t.Fatal("exchanged response message")
|
||||
@ -668,7 +669,7 @@ func init() {
|
||||
}
|
||||
|
||||
func checkInProgressQueriesAtShutdownServer(t *testing.T, srv *Server, addr string, client *Client) {
|
||||
const requests = 100
|
||||
const requests = 15 // enough to make this interesting? TODO: find a proper value
|
||||
|
||||
var errOnce sync.Once
|
||||
// t.Fail will panic if it's called after the test function has
|
||||
@ -698,7 +699,7 @@ func checkInProgressQueriesAtShutdownServer(t *testing.T, srv *Server, addr stri
|
||||
})
|
||||
defer HandleRemove("example.com.")
|
||||
|
||||
client.Timeout = 10 * time.Second
|
||||
client.Timeout = 1 * time.Second
|
||||
|
||||
conns := make([]*Conn, requests)
|
||||
eg := new(errgroup.Group)
|
||||
|
@ -19,12 +19,14 @@ func TestSIG0(t *testing.T) {
|
||||
keyrr.Hdr.Rrtype = TypeKEY
|
||||
keyrr.Hdr.Class = ClassINET
|
||||
keyrr.Algorithm = alg
|
||||
keysize := 1024
|
||||
keysize := 512
|
||||
switch alg {
|
||||
case ECDSAP256SHA256:
|
||||
keysize = 256
|
||||
case ECDSAP384SHA384:
|
||||
keysize = 384
|
||||
case RSASHA512:
|
||||
keysize = 1024
|
||||
}
|
||||
pk, err := keyrr.Generate(keysize)
|
||||
if err != nil {
|
||||
|
Loading…
x
Reference in New Issue
Block a user