MCPcopy
hub / github.com/NVIDIA/aistore / Test_DryRun

Function Test_DryRun

transport/obj_test.go:527–570  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

525}
526
527func Test_DryRun(t *testing.T) {
528 tutils.CheckSkip(t, tutils.SkipTestArgs{Long: true})
529
530 t.Setenv("AIS_STREAM_DRY_RUN", "true")
531
532 stream := transport.NewObjStream(nil, "dummy/null", cos.GenTie(), nil)
533
534 random := newRand(mono.NanoTime())
535 sgl := memsys.PageMM().NewSGL(cos.MiB)
536 defer sgl.Free()
537 buf, slab := memsys.PageMM().AllocSize(cos.KiB * 128)
538 defer slab.Free(buf)
539 for sgl.Len() < cos.MiB {
540 random.Read(buf)
541 sgl.Write(buf)
542 }
543
544 size, num, prevsize := int64(0), 0, int64(0)
545 hdr := genStaticHeader(random)
546 total := int64(cos.TiB)
547 if testing.Short() {
548 total = cos.TiB / 4
549 }
550
551 for size < total {
552 hdr.ObjAttrs.Size = cos.KiB * 128
553 for i := int64(0); i < cos.MiB/hdr.ObjAttrs.Size; i++ {
554 reader := memsys.NewReader(sgl)
555 reader.Seek(i*hdr.ObjAttrs.Size, io.SeekStart)
556
557 stream.Send(&transport.Obj{Hdr: hdr, Reader: reader})
558 num++
559 size += hdr.ObjAttrs.Size
560 if size-prevsize >= cos.GiB*100 {
561 prevsize = size
562 tlog.Logf("[dry]: %d GiB\n", size/cos.GiB)
563 }
564 }
565 }
566 stream.Fin()
567 stats := stream.GetStats()
568
569 fmt.Printf("[dry]: offset=%d, num=%d(%d)\n", stats.Offset.Load(), stats.Num.Load(), num)
570}
571
572func Test_CompletionCount(t *testing.T) {
573 tutils.CheckSkip(t, tutils.SkipTestArgs{Long: true})

Callers

nothing calls this directly

Calls 15

FreeMethod · 0.95
LenMethod · 0.95
WriteMethod · 0.95
SeekMethod · 0.95
CheckSkipFunction · 0.92
NewObjStreamFunction · 0.92
GenTieFunction · 0.92
NanoTimeFunction · 0.92
PageMMFunction · 0.92
NewReaderFunction · 0.92
LogfFunction · 0.92
newRandFunction · 0.85

Tested by

no test coverage detected