(t *testing.T)
| 2326 | } |
| 2327 | |
| 2328 | func TestCreateIndexAddNode(t *testing.T) { |
| 2329 | cfg, mgr0, router0 := testCreateIndex1Node(t, |
| 2330 | []string{`{"maxPartitionsPerPIndex":1}`}, 2, 1) |
| 2331 | |
| 2332 | tests := []*RESTHandlerTest{ |
| 2333 | { |
| 2334 | Desc: "count myIdx should be 0, 1 nodes", |
| 2335 | Path: "/api/index/myIdx/count", |
| 2336 | Method: "GET", |
| 2337 | Status: http.StatusOK, |
| 2338 | ResponseMatch: map[string]bool{ |
| 2339 | `{"status":"ok","count":0}`: true, |
| 2340 | }, |
| 2341 | }, |
| 2342 | { |
| 2343 | Desc: "query myIdx should have 0 hits, 1 nodes", |
| 2344 | Path: "/api/index/myIdx/query", |
| 2345 | Method: "POST", |
| 2346 | Params: nil, |
| 2347 | Body: []byte(`{"size":10,"query":{"query":"no-hits"}}`), |
| 2348 | Status: http.StatusOK, |
| 2349 | ResponseMatch: map[string]bool{ |
| 2350 | `"hits":[],"total_hits":0`: true, |
| 2351 | }, |
| 2352 | }, |
| 2353 | } |
| 2354 | testRESTHandlers(t, tests, router0) |
| 2355 | |
| 2356 | planPIndexesPrev, casPrev, err := cbgt.CfgGetPlanPIndexes(cfg) |
| 2357 | if err != nil { |
| 2358 | t.Errorf("expected no err") |
| 2359 | } |
| 2360 | |
| 2361 | emptyDir1, _ := ioutil.TempDir("./tmp", "test") |
| 2362 | defer os.RemoveAll(emptyDir1) |
| 2363 | |
| 2364 | meh1 := &TestMEH{} |
| 2365 | mgr1 := cbgt.NewManager(cbgt.VERSION, cfg, cbgt.NewUUID(), |
| 2366 | nil, "", 1, "", "localhost:2000", |
| 2367 | emptyDir1, "some-datasource", meh1) |
| 2368 | mgr1.Start("wanted") |
| 2369 | mgr1.Kick("test-start-kick") |
| 2370 | |
| 2371 | nd, _, err := cbgt.CfgGetNodeDefs(cfg, cbgt.NODE_DEFS_KNOWN) |
| 2372 | if err != nil { |
| 2373 | t.Errorf("expected node defs known") |
| 2374 | } |
| 2375 | if len(nd.NodeDefs) != 2 { |
| 2376 | t.Errorf("expected 2 node defs unknown") |
| 2377 | } |
| 2378 | |
| 2379 | nd, _, err = cbgt.CfgGetNodeDefs(cfg, cbgt.NODE_DEFS_WANTED) |
| 2380 | if err != nil { |
| 2381 | t.Errorf("expected node defs wanted") |
| 2382 | } |
| 2383 | if len(nd.NodeDefs) != 2 { |
| 2384 | t.Errorf("expected 2 node defs wanted") |
| 2385 | } |
nothing calls this directly
no test coverage detected