From 5fc7e36983f87c22bb2b4189c878952864589c3c Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Wed, 12 Nov 2014 10:19:20 +0000 Subject: [PATCH] go test -short Added a bunch a long running test function to the list of skipped tests when giving -short to go test. Tests are bascially *all* DNSSEC key generation tests and 1 serving test. PASS ok github.com/miekg/dns 0.782s Compared to 13+ s, so quite a bit faster. --- dnssec_test.go | 12 ++++++++++++ parse_test.go | 3 +++ server_test.go | 3 +++ sig0_test.go | 3 +++ 4 files changed, 21 insertions(+) diff --git a/dnssec_test.go b/dnssec_test.go index 484367cf..04c64391 100644 --- a/dnssec_test.go +++ b/dnssec_test.go @@ -34,6 +34,9 @@ func getSoa() *SOA { } func TestGenerateEC(t *testing.T) { + if testing.Short() { + t.Skip("skipping test in short mode.") + } key := new(DNSKEY) key.Hdr.Rrtype = TypeDNSKEY key.Hdr.Name = "miek.nl." @@ -48,6 +51,9 @@ func TestGenerateEC(t *testing.T) { } func TestGenerateDSA(t *testing.T) { + if testing.Short() { + t.Skip("skipping test in short mode.") + } key := new(DNSKEY) key.Hdr.Rrtype = TypeDNSKEY key.Hdr.Name = "miek.nl." @@ -62,6 +68,9 @@ func TestGenerateDSA(t *testing.T) { } func TestGenerateRSA(t *testing.T) { + if testing.Short() { + t.Skip("skipping test in short mode.") + } key := new(DNSKEY) key.Hdr.Rrtype = TypeDNSKEY key.Hdr.Name = "miek.nl." @@ -283,6 +292,9 @@ func TestTag(t *testing.T) { } func TestKeyRSA(t *testing.T) { + if testing.Short() { + t.Skip("skipping test in short mode.") + } key := new(DNSKEY) key.Hdr.Name = "miek.nl." key.Hdr.Rrtype = TypeDNSKEY diff --git a/parse_test.go b/parse_test.go index 1b7f0d37..a4369c38 100644 --- a/parse_test.go +++ b/parse_test.go @@ -1231,6 +1231,9 @@ type algorithm struct { } func TestNewPrivateKeyECDSA(t *testing.T) { + if testing.Short() { + t.Skip("skipping test in short mode.") + } algorithms := []algorithm{ algorithm{ECDSAP256SHA256, 256}, algorithm{ECDSAP384SHA384, 384}, diff --git a/server_test.go b/server_test.go index b5d57c93..bc425a3a 100644 --- a/server_test.go +++ b/server_test.go @@ -303,6 +303,9 @@ func TestServingLargeResponses(t *testing.T) { } func TestServingResponse(t *testing.T) { + if testing.Short() { + t.Skip("skipping test in short mode.") + } HandleFunc("miek.nl.", HelloServer) s, addrstr, err := RunLocalUDPServer("127.0.0.1:0") if err != nil { diff --git a/sig0_test.go b/sig0_test.go index 1a18e260..6ca76fb8 100644 --- a/sig0_test.go +++ b/sig0_test.go @@ -6,6 +6,9 @@ import ( ) func TestSIG0(t *testing.T) { + if testing.Short() { + t.Skip("skipping test in short mode.") + } m := new(Msg) m.SetQuestion("example.org.", TypeSOA) for _, alg := range []uint8{DSA, ECDSAP256SHA256, ECDSAP384SHA384, RSASHA1, RSASHA256, RSASHA512} {