(daemonID string, smap *testSmap)
| 139 | } |
| 140 | |
| 141 | func 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 | |
| 172 | func (t *targetNodeMock) setHandlers(handlers map[string]http.HandlerFunc) { |
| 173 | mux := mux.NewServeMux() |
no test coverage detected