testutil/testutil.go | 8 ++++++++ tracker/udp/udp_tracker_test.go | 11 +---------- diff --git a/testutil/testutil.go b/testutil/testutil.go index 4dba814491d3f7a6ac1e4100850be5caa41712be..4a150b08f4982e31d03ea9aabd42489f5d15784e 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 @@ errs, _ := batch.Start(w, 1) <-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 51b6dad7a97d773e8e2a737017b11840d2de7df4..4d3a9b0d8464d96662765964ea3bf6513b4a9bce 100644 --- a/tracker/udp/udp_tracker_test.go +++ b/tracker/udp/udp_tracker_test.go @@ -98,19 +98,10 @@ Event: tracker.Started, } 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) {