From: Matt Joiner Date: Fri, 15 Sep 2017 09:34:42 +0000 (+1000) Subject: fs: Fix tests now that data verification isn't automatic X-Git-Tag: v1.0.0~393 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=f7e07237ed089923383f2d7c22572e5c53a87a82;p=btrtrc.git fs: Fix tests now that data verification isn't automatic --- diff --git a/fs/torrentfs_test.go b/fs/torrentfs_test.go index 2625cc3c..ab3ab4bc 100644 --- a/fs/torrentfs_test.go +++ b/fs/torrentfs_test.go @@ -178,8 +178,15 @@ func TestDownloadOnDemand(t *testing.T) { require.NoError(t, err) defer seeder.Close() testutil.ExportStatusWriter(seeder, "s") - _, err = seeder.AddMagnet(fmt.Sprintf("magnet:?xt=urn:btih:%s", layout.Metainfo.HashInfoBytes().HexString())) + // Just to mix things up, the seeder starts with the data, but the leecher + // starts with the metainfo. + seederTorrent, err := seeder.AddMagnet(fmt.Sprintf("magnet:?xt=urn:btih:%s", layout.Metainfo.HashInfoBytes().HexString())) require.NoError(t, err) + go func() { + // Wait until we get the metainfo, then check for the data. + <-seederTorrent.GotInfo() + seederTorrent.VerifyData() + }() leecher, err := torrent.NewClient(&torrent.Config{ DisableTrackers: true, NoDHT: true,