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

Function newTargetMock

dsort/dsort_test.go:141–170  ·  view source on GitHub ↗
(daemonID string, smap *testSmap)

Source from the content-addressed store, hash-verified

139}
140
141func newTargetMock(daemonID string, smap *testSmap) *targetNodeMock {
142 // Initialize dSort manager
143 rs := &ParsedRequestSpec{
144 Extension: cos.ExtTar,
145 Algorithm: &SortAlgorithm{
146 FormatType: extract.FormatTypeString,
147 },
148 MaxMemUsage: cos.ParsedQuantity{Type: cos.QuantityPercent, Value: 0},
149 DSorterType: DSorterGeneralType,
150 }
151
152 db := mock.NewDBDriver()
153 dsortManagers := NewManagerGroup(db, true /*skip hk*/)
154 dsortManager, err := dsortManagers.Add(globalManagerUUID)
155 Expect(err).ShouldNot(HaveOccurred())
156 ctx.node = smap.Get().Tmap[daemonID]
157 dsortManager.init(rs)
158 dsortManager.unlock()
159
160 net := smap.GetTarget(daemonID).PubNet
161 return &targetNodeMock{
162 daemonID: daemonID,
163 s: &http.Server{
164 Addr: fmt.Sprintf("%s:%s", net.Hostname, net.Port),
165 Handler: http.NewServeMux(),
166 },
167 controlCh: make(chan error, 1),
168 managers: dsortManagers,
169 }
170}
171
172func (t *targetNodeMock) setHandlers(handlers map[string]http.HandlerFunc) {
173 mux := mux.NewServeMux()

Callers 1

setupMethod · 0.85

Calls 7

AddMethod · 0.95
NewDBDriverFunction · 0.92
NewManagerGroupFunction · 0.85
GetTargetMethod · 0.80
GetMethod · 0.65
initMethod · 0.65
unlockMethod · 0.45

Tested by

no test coverage detected