Skip to content

Commit

Permalink
Merge sidnxfr_test.go into xfr_test.go
Browse files Browse the repository at this point in the history
* Export tests in xfr_test.go
* Rename tests to be `go test -run` friendly
* Hide behind 'net' build tag
  • Loading branch information
andrewtj committed Aug 23, 2015
1 parent b1bc8d7 commit fe0937f
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 81 deletions.
78 changes: 0 additions & 78 deletions sidnxfr_test.go

This file was deleted.

75 changes: 72 additions & 3 deletions xfr_test.go
@@ -1,3 +1,5 @@
// +build net

package dns

import (
Expand All @@ -16,7 +18,8 @@ func getIP(s string) string {

// flaky, need to setup local server and test from
// that.
func testClientAXFR(t *testing.T) {
func TestAXFR_Miek(t *testing.T) {
// This test runs against a server maintained by Miek
if testing.Short() {
return
}
Expand All @@ -43,7 +46,8 @@ func testClientAXFR(t *testing.T) {
}

// fails.
func testClientAXFRMultipleEnvelopes(t *testing.T) {
func TestAXFR_NLNL_MultipleEnvelopes(t *testing.T) {
// This test runs against a server maintained by NLnet Labs
if testing.Short() {
return
}
Expand All @@ -65,7 +69,8 @@ func testClientAXFRMultipleEnvelopes(t *testing.T) {
}
}

func testClientTsigAXFR(t *testing.T) {
func TestAXFR_Miek_Tsig(t *testing.T) {
// This test runs against a server maintained by Miek
if testing.Short() {
return
}
Expand All @@ -90,3 +95,67 @@ func testClientTsigAXFR(t *testing.T) {
}
}
}

func TestAXFR_SIDN_NSD3_NONE(t *testing.T) { testAXFRSIDN(t, "nsd", "") }
func TestAXFR_SIDN_NSD3_MD5(t *testing.T) { testAXFRSIDN(t, "nsd", HmacMD5) }
func TestAXFR_SIDN_NSD3_SHA1(t *testing.T) { testAXFRSIDN(t, "nsd", HmacSHA1) }
func TestAXFR_SIDN_NSD3_SHA256(t *testing.T) { testAXFRSIDN(t, "nsd", HmacSHA256) }

func TestAXFR_SIDN_NSD4_NONE(t *testing.T) { testAXFRSIDN(t, "nsd4", "") }
func TestAXFR_SIDN_NSD4_MD5(t *testing.T) { testAXFRSIDN(t, "nsd4", HmacMD5) }
func TestAXFR_SIDN_NSD4_SHA1(t *testing.T) { testAXFRSIDN(t, "nsd4", HmacSHA1) }
func TestAXFR_SIDN_NSD4_SHA256(t *testing.T) { testAXFRSIDN(t, "nsd4", HmacSHA256) }

func TestAXFR_SIDN_BIND9_NONE(t *testing.T) { testAXFRSIDN(t, "bind9", "") }
func TestAXFR_SIDN_BIND9_MD5(t *testing.T) { testAXFRSIDN(t, "bind9", HmacMD5) }
func TestAXFR_SIDN_BIND9_SHA1(t *testing.T) { testAXFRSIDN(t, "bind9", HmacSHA1) }
func TestAXFR_SIDN_BIND9_SHA256(t *testing.T) { testAXFRSIDN(t, "bind9", HmacSHA256) }

func TestAXFR_SIDN_KNOT_NONE(t *testing.T) { testAXFRSIDN(t, "knot", "") }
func TestAXFR_SIDN_KNOT_MD5(t *testing.T) { testAXFRSIDN(t, "knot", HmacMD5) }
func TestAXFR_SIDN_KNOT_SHA1(t *testing.T) { testAXFRSIDN(t, "knot", HmacSHA1) }
func TestAXFR_SIDN_KNOT_SHA256(t *testing.T) { testAXFRSIDN(t, "knot", HmacSHA256) }

func TestAXFR_SIDN_POWERDNS_NONE(t *testing.T) { testAXFRSIDN(t, "powerdns", "") }
func TestAXFR_SIDN_POWERDNS_MD5(t *testing.T) { testAXFRSIDN(t, "powerdns", HmacMD5) }
func TestAXFR_SIDN_POWERDNS_SHA1(t *testing.T) { testAXFRSIDN(t, "powerdns", HmacSHA1) }
func TestAXFR_SIDN_POWERDNS_SHA256(t *testing.T) { testAXFRSIDN(t, "powerdns", HmacSHA256) }

func TestAXFR_SIDN_YADIFA_NONE(t *testing.T) { testAXFRSIDN(t, "yadifa", "") }
func TestAXFR_SIDN_YADIFA_MD5(t *testing.T) { testAXFRSIDN(t, "yadifa", HmacMD5) }
func TestAXFR_SIDN_YADIFA_SHA1(t *testing.T) { testAXFRSIDN(t, "yadifa", HmacSHA1) }
func TestAXFR_SIDN_YADIFA_SHA256(t *testing.T) { testAXFRSIDN(t, "yadifa", HmacSHA256) }

func testAXFRSIDN(t *testing.T, host, alg string) {
// This tests run against a server maintained by SIDN labs, see:
// https://workbench.sidnlabs.nl/
if testing.Short() {
return
}
x := new(Transfer)
x.TsigSecret = map[string]string{
"wb_md5.": "Wu/utSasZUkoeCNku152Zw==",
"wb_sha1_longkey.": "uhMpEhPq/RAD9Bt4mqhfmi+7ZdKmjLQb/lcrqYPXR4s/nnbsqw==",
"wb_sha256.": "npfrIJjt/MJOjGJoBNZtsjftKMhkSpIYMv2RzRZt1f8=",
}
keyname := map[string]string{
HmacMD5: "wb_md5.",
HmacSHA1: "wb_sha1_longkey.",
HmacSHA256: "wb_sha256.",
}[alg]

m := new(Msg)
m.SetAxfr("types.wb.sidnlabs.nl.")
if keyname != "" {
m.SetTsig(keyname, alg, 300, time.Now().Unix())
}
c, err := x.In(m, host+".sidnlabs.nl:53")
if err != nil {
t.Fatal(err)
}
for e := range c {
if e.Error != nil {
t.Fatal(e.Error)
}
}
}

0 comments on commit fe0937f

Please sign in to comment.