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

Function TestMain

ais/tgtobj_test.go:53–91  ·  view source on GitHub ↗
(m *testing.M)

Source from the content-addressed store, hash-verified

51func (*discardRW) WriteHeader(int) {}
52
53func TestMain(m *testing.M) {
54 flag.Parse()
55
56 // file system
57 cos.CreateDir(testMountpath)
58 defer os.RemoveAll(testMountpath)
59 fs.TestNew(nil)
60 fs.TestDisableValidation()
61 _ = fs.CSM.Reg(fs.ObjectType, &fs.ObjectContentResolver{})
62 _ = fs.CSM.Reg(fs.WorkfileType, &fs.WorkfileContentResolver{})
63
64 // target
65 config := cmn.GCO.Get()
66 co := newConfigOwner(config)
67 t = newTarget(co)
68 t.name = apc.Target
69 t.initNetworks()
70 tid, _ := initTID(config)
71 t.si.Init(tid, apc.Target)
72
73 fs.Add(testMountpath, t.si.ID())
74
75 t.htrun.init(config)
76
77 t.statsT = mock.NewStatsTracker()
78 cluster.Init(t)
79
80 bck := cluster.NewBck(testBucket, apc.ProviderAIS, cmn.NsGlobal)
81 bmd := newBucketMD()
82 bmd.add(bck, &cmn.BucketProps{
83 Cksum: cmn.CksumConf{
84 Type: cos.ChecksumNone,
85 },
86 })
87 t.owner.bmd.putPersist(bmd, nil)
88 fs.CreateBucket("test", bck.Bucket(), false /*nilbmd*/)
89
90 m.Run()
91}
92
93func BenchmarkObjPut(b *testing.B) {
94 benches := []struct {

Callers

nothing calls this directly

Calls 15

BucketMethod · 0.95
CreateDirFunction · 0.92
TestNewFunction · 0.92
TestDisableValidationFunction · 0.92
AddFunction · 0.92
NewStatsTrackerFunction · 0.92
InitFunction · 0.92
NewBckFunction · 0.92
CreateBucketFunction · 0.92
newConfigOwnerFunction · 0.85
newTargetFunction · 0.85
initTIDFunction · 0.85

Tested by

no test coverage detected