mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-29 17:36:38 +08:00
chore(tests) add Short() -> SkipNow() to slowest tests
vanilla: 21.57 real 45.14 user 8.51 sys short: 14.40 real 31.13 user 5.56 sys License: MIT Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
This commit is contained in:

committed by
Juan Batiz-Benet

parent
25b3106e41
commit
ed4a8eb782
@ -90,6 +90,9 @@ func TestGetBlockFromPeerAfterPeerAnnounces(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSwarm(t *testing.T) {
|
func TestSwarm(t *testing.T) {
|
||||||
|
if testing.Short() {
|
||||||
|
t.SkipNow()
|
||||||
|
}
|
||||||
net := tn.VirtualNetwork()
|
net := tn.VirtualNetwork()
|
||||||
rs := mock.VirtualRoutingServer()
|
rs := mock.VirtualRoutingServer()
|
||||||
sg := NewSessionGenerator(net, rs)
|
sg := NewSessionGenerator(net, rs)
|
||||||
|
@ -83,6 +83,9 @@ func setupIpnsTest(t *testing.T, node *core.IpfsNode) (*core.IpfsNode, *fstest.M
|
|||||||
|
|
||||||
// Test writing a file and reading it back
|
// Test writing a file and reading it back
|
||||||
func TestIpnsBasicIO(t *testing.T) {
|
func TestIpnsBasicIO(t *testing.T) {
|
||||||
|
if testing.Short() {
|
||||||
|
t.SkipNow()
|
||||||
|
}
|
||||||
_, mnt := setupIpnsTest(t, nil)
|
_, mnt := setupIpnsTest(t, nil)
|
||||||
defer mnt.Close()
|
defer mnt.Close()
|
||||||
|
|
||||||
@ -101,6 +104,9 @@ func TestIpnsBasicIO(t *testing.T) {
|
|||||||
|
|
||||||
// Test to make sure file changes persist over mounts of ipns
|
// Test to make sure file changes persist over mounts of ipns
|
||||||
func TestFilePersistence(t *testing.T) {
|
func TestFilePersistence(t *testing.T) {
|
||||||
|
if testing.Short() {
|
||||||
|
t.SkipNow()
|
||||||
|
}
|
||||||
node, mnt := setupIpnsTest(t, nil)
|
node, mnt := setupIpnsTest(t, nil)
|
||||||
|
|
||||||
fname := "/local/atestfile"
|
fname := "/local/atestfile"
|
||||||
@ -126,6 +132,9 @@ func TestFilePersistence(t *testing.T) {
|
|||||||
|
|
||||||
// Test to make sure the filesystem reports file sizes correctly
|
// Test to make sure the filesystem reports file sizes correctly
|
||||||
func TestFileSizeReporting(t *testing.T) {
|
func TestFileSizeReporting(t *testing.T) {
|
||||||
|
if testing.Short() {
|
||||||
|
t.SkipNow()
|
||||||
|
}
|
||||||
_, mnt := setupIpnsTest(t, nil)
|
_, mnt := setupIpnsTest(t, nil)
|
||||||
defer mnt.Close()
|
defer mnt.Close()
|
||||||
|
|
||||||
@ -144,6 +153,9 @@ func TestFileSizeReporting(t *testing.T) {
|
|||||||
|
|
||||||
// Test to make sure you cant create multiple entries with the same name
|
// Test to make sure you cant create multiple entries with the same name
|
||||||
func TestDoubleEntryFailure(t *testing.T) {
|
func TestDoubleEntryFailure(t *testing.T) {
|
||||||
|
if testing.Short() {
|
||||||
|
t.SkipNow()
|
||||||
|
}
|
||||||
_, mnt := setupIpnsTest(t, nil)
|
_, mnt := setupIpnsTest(t, nil)
|
||||||
defer mnt.Close()
|
defer mnt.Close()
|
||||||
|
|
||||||
@ -160,6 +172,9 @@ func TestDoubleEntryFailure(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestAppendFile(t *testing.T) {
|
func TestAppendFile(t *testing.T) {
|
||||||
|
if testing.Short() {
|
||||||
|
t.SkipNow()
|
||||||
|
}
|
||||||
_, mnt := setupIpnsTest(t, nil)
|
_, mnt := setupIpnsTest(t, nil)
|
||||||
defer mnt.Close()
|
defer mnt.Close()
|
||||||
|
|
||||||
@ -198,6 +213,9 @@ func TestAppendFile(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestFastRepublish(t *testing.T) {
|
func TestFastRepublish(t *testing.T) {
|
||||||
|
if testing.Short() {
|
||||||
|
t.SkipNow()
|
||||||
|
}
|
||||||
|
|
||||||
// make timeout noticeable.
|
// make timeout noticeable.
|
||||||
osrt := shortRepublishTimeout
|
osrt := shortRepublishTimeout
|
||||||
@ -299,6 +317,9 @@ func TestFastRepublish(t *testing.T) {
|
|||||||
|
|
||||||
// Test writing a medium sized file one byte at a time
|
// Test writing a medium sized file one byte at a time
|
||||||
func TestMultiWrite(t *testing.T) {
|
func TestMultiWrite(t *testing.T) {
|
||||||
|
if testing.Short() {
|
||||||
|
t.SkipNow()
|
||||||
|
}
|
||||||
|
|
||||||
_, mnt := setupIpnsTest(t, nil)
|
_, mnt := setupIpnsTest(t, nil)
|
||||||
defer mnt.Close()
|
defer mnt.Close()
|
||||||
|
@ -21,6 +21,9 @@ func copyBuf(buf []byte) []byte {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSizeSplitterIsDeterministic(t *testing.T) {
|
func TestSizeSplitterIsDeterministic(t *testing.T) {
|
||||||
|
if testing.Short() {
|
||||||
|
t.SkipNow()
|
||||||
|
}
|
||||||
|
|
||||||
test := func() {
|
test := func() {
|
||||||
bufR := randBuf(t, 10000000) // crank this up to satisfy yourself.
|
bufR := randBuf(t, 10000000) // crank this up to satisfy yourself.
|
||||||
|
@ -19,6 +19,9 @@ import (
|
|||||||
// These tests tests a combination of unixfs/io/dagreader and importer/chunk.
|
// These tests tests a combination of unixfs/io/dagreader and importer/chunk.
|
||||||
// Maybe split them up somehow?
|
// Maybe split them up somehow?
|
||||||
func TestBuildDag(t *testing.T) {
|
func TestBuildDag(t *testing.T) {
|
||||||
|
if testing.Short() {
|
||||||
|
t.SkipNow()
|
||||||
|
}
|
||||||
td := os.TempDir()
|
td := os.TempDir()
|
||||||
fi, err := os.Create(td + "/tmpfi")
|
fi, err := os.Create(td + "/tmpfi")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -40,6 +43,9 @@ func TestBuildDag(t *testing.T) {
|
|||||||
|
|
||||||
//Test where calls to read are smaller than the chunk size
|
//Test where calls to read are smaller than the chunk size
|
||||||
func TestSizeBasedSplit(t *testing.T) {
|
func TestSizeBasedSplit(t *testing.T) {
|
||||||
|
if testing.Short() {
|
||||||
|
t.SkipNow()
|
||||||
|
}
|
||||||
bs := &chunk.SizeSplitter{Size: 512}
|
bs := &chunk.SizeSplitter{Size: 512}
|
||||||
testFileConsistency(t, bs, 32*512)
|
testFileConsistency(t, bs, 32*512)
|
||||||
bs = &chunk.SizeSplitter{Size: 4096}
|
bs = &chunk.SizeSplitter{Size: 4096}
|
||||||
@ -118,10 +124,16 @@ func arrComp(a, b []byte) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestMaybeRabinConsistency(t *testing.T) {
|
func TestMaybeRabinConsistency(t *testing.T) {
|
||||||
|
if testing.Short() {
|
||||||
|
t.SkipNow()
|
||||||
|
}
|
||||||
testFileConsistency(t, chunk.NewMaybeRabin(4096), 256*4096)
|
testFileConsistency(t, chunk.NewMaybeRabin(4096), 256*4096)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestRabinBlockSize(t *testing.T) {
|
func TestRabinBlockSize(t *testing.T) {
|
||||||
|
if testing.Short() {
|
||||||
|
t.SkipNow()
|
||||||
|
}
|
||||||
buf := new(bytes.Buffer)
|
buf := new(bytes.Buffer)
|
||||||
nbytes := 1024 * 1024
|
nbytes := 1024 * 1024
|
||||||
io.CopyN(buf, rand.Reader, int64(nbytes))
|
io.CopyN(buf, rand.Reader, int64(nbytes))
|
||||||
|
@ -83,7 +83,9 @@ func TestCancel(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestCloseLeak(t *testing.T) {
|
func TestCloseLeak(t *testing.T) {
|
||||||
// t.Skip("Skipping in favor of another test")
|
if testing.Short() {
|
||||||
|
t.SkipNow()
|
||||||
|
}
|
||||||
|
|
||||||
if os.Getenv("TRAVIS") == "true" {
|
if os.Getenv("TRAVIS") == "true" {
|
||||||
t.Skip("this doesn't work well on travis")
|
t.Skip("this doesn't work well on travis")
|
||||||
|
@ -156,7 +156,9 @@ func setupMultiConns(t *testing.T, ctx context.Context) (a, b *MultiConn) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestMulticonnSend(t *testing.T) {
|
func TestMulticonnSend(t *testing.T) {
|
||||||
// t.Skip("fooo")
|
if testing.Short() {
|
||||||
|
t.SkipNow()
|
||||||
|
}
|
||||||
|
|
||||||
log.Info("TestMulticonnSend")
|
log.Info("TestMulticonnSend")
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
@ -220,7 +222,9 @@ func TestMulticonnSend(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestMulticonnSendUnderlying(t *testing.T) {
|
func TestMulticonnSendUnderlying(t *testing.T) {
|
||||||
// t.Skip("fooo")
|
if testing.Short() {
|
||||||
|
t.SkipNow()
|
||||||
|
}
|
||||||
|
|
||||||
log.Info("TestMulticonnSendUnderlying")
|
log.Info("TestMulticonnSendUnderlying")
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
@ -105,7 +105,9 @@ func TestSecureCancel(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSecureCloseLeak(t *testing.T) {
|
func TestSecureCloseLeak(t *testing.T) {
|
||||||
// t.Skip("Skipping in favor of another test")
|
if testing.Short() {
|
||||||
|
t.SkipNow()
|
||||||
|
}
|
||||||
if os.Getenv("TRAVIS") == "true" {
|
if os.Getenv("TRAVIS") == "true" {
|
||||||
t.Skip("this doesn't work well on travis")
|
t.Skip("this doesn't work well on travis")
|
||||||
}
|
}
|
||||||
|
@ -103,6 +103,9 @@ func TestSimpleMuxer(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSimultMuxer(t *testing.T) {
|
func TestSimultMuxer(t *testing.T) {
|
||||||
|
if testing.Short() {
|
||||||
|
t.SkipNow()
|
||||||
|
}
|
||||||
// run muxer
|
// run muxer
|
||||||
ctx, cancel := context.WithCancel(context.Background())
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
|
|
||||||
|
@ -11,7 +11,9 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestSimultOpen(t *testing.T) {
|
func TestSimultOpen(t *testing.T) {
|
||||||
// t.Skip("skipping for another test")
|
if testing.Short() {
|
||||||
|
t.SkipNow()
|
||||||
|
}
|
||||||
|
|
||||||
addrs := []string{
|
addrs := []string{
|
||||||
"/ip4/127.0.0.1/tcp/1244",
|
"/ip4/127.0.0.1/tcp/1244",
|
||||||
@ -61,6 +63,9 @@ func TestSimultOpenMany(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSimultOpenFewStress(t *testing.T) {
|
func TestSimultOpenFewStress(t *testing.T) {
|
||||||
|
if testing.Short() {
|
||||||
|
t.SkipNow()
|
||||||
|
}
|
||||||
// t.Skip("skipping for another test")
|
// t.Skip("skipping for another test")
|
||||||
|
|
||||||
num := 10
|
num := 10
|
||||||
|
@ -167,6 +167,9 @@ func SubtestSwarm(t *testing.T, addrs []string, MsgNum int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSwarm(t *testing.T) {
|
func TestSwarm(t *testing.T) {
|
||||||
|
if testing.Short() {
|
||||||
|
t.SkipNow()
|
||||||
|
}
|
||||||
// t.Skip("skipping for another test")
|
// t.Skip("skipping for another test")
|
||||||
|
|
||||||
addrs := []string{
|
addrs := []string{
|
||||||
|
@ -73,6 +73,9 @@ func newPeerTime(t time.Time) peer.Peer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSyncQueue(t *testing.T) {
|
func TestSyncQueue(t *testing.T) {
|
||||||
|
if testing.Short() {
|
||||||
|
t.SkipNow()
|
||||||
|
}
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
||||||
pq := NewXORDistancePQ(u.Key("11140beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a31"))
|
pq := NewXORDistancePQ(u.Key("11140beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a31"))
|
||||||
|
@ -231,7 +231,9 @@ func TestProvides(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestProvidesAsync(t *testing.T) {
|
func TestProvidesAsync(t *testing.T) {
|
||||||
// t.Skip("skipping test to debug another")
|
if testing.Short() {
|
||||||
|
t.SkipNow()
|
||||||
|
}
|
||||||
|
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
u.Debug = false
|
u.Debug = false
|
||||||
@ -295,7 +297,9 @@ func TestProvidesAsync(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestLayeredGet(t *testing.T) {
|
func TestLayeredGet(t *testing.T) {
|
||||||
// t.Skip("skipping test to debug another")
|
if testing.Short() {
|
||||||
|
t.SkipNow()
|
||||||
|
}
|
||||||
|
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
u.Debug = false
|
u.Debug = false
|
||||||
@ -347,7 +351,9 @@ func TestLayeredGet(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestFindPeer(t *testing.T) {
|
func TestFindPeer(t *testing.T) {
|
||||||
// t.Skip("skipping test to debug another")
|
if testing.Short() {
|
||||||
|
t.SkipNow()
|
||||||
|
}
|
||||||
|
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
u.Debug = false
|
u.Debug = false
|
||||||
@ -391,7 +397,9 @@ func TestFindPeer(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestConnectCollision(t *testing.T) {
|
func TestConnectCollision(t *testing.T) {
|
||||||
// t.Skip("skipping test to debug another")
|
if testing.Short() {
|
||||||
|
t.SkipNow()
|
||||||
|
}
|
||||||
|
|
||||||
runTimes := 10
|
runTimes := 10
|
||||||
|
|
||||||
|
@ -115,7 +115,9 @@ func (f *fauxNet) GetBandwidthTotals() (uint64, uint64) {
|
|||||||
func (f *fauxNet) Close() error { return nil }
|
func (f *fauxNet) Close() error { return nil }
|
||||||
|
|
||||||
func TestGetFailures(t *testing.T) {
|
func TestGetFailures(t *testing.T) {
|
||||||
// t.Skip("skipping test because it makes a lot of output")
|
if testing.Short() {
|
||||||
|
t.SkipNow()
|
||||||
|
}
|
||||||
|
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
fn := &fauxNet{}
|
fn := &fauxNet{}
|
||||||
@ -211,7 +213,9 @@ func _randPeer() peer.Peer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestNotFound(t *testing.T) {
|
func TestNotFound(t *testing.T) {
|
||||||
// t.Skip("skipping test because it makes a lot of output")
|
if testing.Short() {
|
||||||
|
t.SkipNow()
|
||||||
|
}
|
||||||
|
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
fn := &fauxNet{}
|
fn := &fauxNet{}
|
||||||
|
@ -29,6 +29,9 @@ func TestKey(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestByteChanReader(t *testing.T) {
|
func TestByteChanReader(t *testing.T) {
|
||||||
|
if testing.Short() {
|
||||||
|
t.SkipNow()
|
||||||
|
}
|
||||||
|
|
||||||
var data bytes.Buffer
|
var data bytes.Buffer
|
||||||
var data2 bytes.Buffer
|
var data2 bytes.Buffer
|
||||||
|
Reference in New Issue
Block a user