From 9e7caacbe3e267ee4cb86aea00cec65f859a173f Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Thu, 20 Mar 2014 22:02:15 +1100 Subject: [PATCH] Tidy up --- testutil/testutil.go | 8 ++++++++ tracker/udp/udp_tracker_test.go | 11 +---------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/testutil/testutil.go b/testutil/testutil.go index 4dba8144..4a150b08 100644 --- a/testutil/testutil.go +++ b/testutil/testutil.go @@ -1,3 +1,8 @@ +// Package testutil contains stuff for testing torrent-related behaviour. +// +// "greeting" is a single-file torrent of a file called "greeting" that +// "contains "hello, world\n". + package testutil import ( @@ -31,6 +36,9 @@ func CreateMetaInfo(name string, w io.Writer) { <-errs } +// Gives a temporary directory containing the completed "greeting" torrent, +// and a corresponding metainfo describing it. The temporary directory can be +// cleaned away with os.RemoveAll. func GreetingTestTorrent() (tempDir string, metaInfo *metainfo.MetaInfo) { tempDir, err := ioutil.TempDir(os.TempDir(), "") if err != nil { diff --git a/tracker/udp/udp_tracker_test.go b/tracker/udp/udp_tracker_test.go index 51b6dad7..4d3a9b0d 100644 --- a/tracker/udp/udp_tracker_test.go +++ b/tracker/udp/udp_tracker_test.go @@ -98,19 +98,10 @@ func TestUDPTracker(t *testing.T) { } rand.Read(req.PeerId[:]) copy(req.InfoHash[:], []uint8{0xa3, 0x56, 0x41, 0x43, 0x74, 0x23, 0xe6, 0x26, 0xd9, 0x38, 0x25, 0x4a, 0x6b, 0x80, 0x49, 0x10, 0xa6, 0x67, 0xa, 0xc1}) - // TODO: Find out what torrent this info hash corresponds to. - // n, err := hex.Decode(req.InfoHash[:], []byte("c833bb2b5e7bcb9c07f4c020b4be430c28ba7cdb")) - // if err != nil { - // t.Fatal(err) - // } - // if n != len(req.InfoHash) { - // panic("nope") - // } - resp, err := tr.Announce(&req) + _, err = tr.Announce(&req) if err != nil { t.Fatal(err) } - t.Log(resp) } func TestAnnounceRandomInfoHash(t *testing.T) {