(t *testing.T)
| 2998 | } |
| 2999 | |
| 3000 | func TestMultiFeedStats(t *testing.T) { |
| 3001 | rest.RequestProxyStubFunc = func() bool { |
| 3002 | return false |
| 3003 | } |
| 3004 | emptyDir, _ := ioutil.TempDir("./tmp", "test") |
| 3005 | defer func() { |
| 3006 | os.RemoveAll(emptyDir) |
| 3007 | rest.RequestProxyStubFunc = nil |
| 3008 | }() |
| 3009 | |
| 3010 | cfg := cbgt.NewCfgMem() |
| 3011 | meh := &TestMEH{} |
| 3012 | mgr := cbgt.NewManager(cbgt.VERSION, cfg, cbgt.NewUUID(), |
| 3013 | nil, "", 1, "", ":1000", emptyDir, "some-datasource", meh) |
| 3014 | mgr.Start("wanted") |
| 3015 | mgr.Kick("test-start-kick") |
| 3016 | |
| 3017 | mr, _ := cbgt.NewMsgRing(os.Stderr, 1000) |
| 3018 | mr.Write([]byte("hello")) |
| 3019 | mr.Write([]byte("world")) |
| 3020 | |
| 3021 | router, _, err := NewRESTRouter("v0", mgr, "static", "", mr, nil) |
| 3022 | if err != nil || router == nil { |
| 3023 | t.Errorf("no mux router") |
| 3024 | } |
| 3025 | |
| 3026 | tests := []*RESTHandlerTest{ |
| 3027 | { |
| 3028 | Desc: "create another index with primary feed", |
| 3029 | Path: "/api/index/idx0", |
| 3030 | Method: "PUT", |
| 3031 | Params: url.Values{ |
| 3032 | "indexType": []string{"fulltext-index"}, |
| 3033 | "sourceType": []string{"primary"}, |
| 3034 | "sourceParams": []string{`{"numPartitions":10}`}, |
| 3035 | }, |
| 3036 | Body: nil, |
| 3037 | Status: http.StatusOK, |
| 3038 | ResponseMatch: map[string]bool{ |
| 3039 | `"status":"ok"`: true, |
| 3040 | }, |
| 3041 | }, |
| 3042 | { |
| 3043 | Desc: "create another index with primary feed", |
| 3044 | Path: "/api/index/idx1", |
| 3045 | Method: "PUT", |
| 3046 | Params: url.Values{ |
| 3047 | "indexType": []string{"fulltext-index"}, |
| 3048 | "sourceType": []string{"primary"}, |
| 3049 | "sourceParams": []string{`{"numPartitions":10}`}, |
| 3050 | }, |
| 3051 | Body: nil, |
| 3052 | Status: http.StatusOK, |
| 3053 | ResponseMatch: map[string]bool{ |
| 3054 | `"status":"ok"`: true, |
| 3055 | }, |
| 3056 | }, |
| 3057 | { |
nothing calls this directly
no test coverage detected