From 995c4896e2d8b4a84e27486e6bedbc24731ceb97 Mon Sep 17 00:00:00 2001 From: darshanime Date: Mon, 27 Apr 2020 22:30:52 +0530 Subject: [PATCH] Add deleteSeries skeleton to return bad request Signed-off-by: darshanime --- pkg/query/api/v1.go | 6 +++++ pkg/query/api/v1_test.go | 47 +++++++++++++++++++++++----------------- 2 files changed, 33 insertions(+), 20 deletions(-) diff --git a/pkg/query/api/v1.go b/pkg/query/api/v1.go index 2842055a5a9..efc9f384276 100644 --- a/pkg/query/api/v1.go +++ b/pkg/query/api/v1.go @@ -166,6 +166,8 @@ func (api *API) Register(r *route.Router, tracer opentracing.Tracer, logger log. r.Get("/series", instr("series", api.series)) r.Post("/series", instr("series", api.series)) + r.Post("/delete_series", instr("delete_series", api.deleteSeries)) + r.Get("/labels", instr("label_names", api.labelNames)) r.Post("/labels", instr("label_names", api.labelNames)) } @@ -536,6 +538,10 @@ func (api *API) series(r *http.Request) (interface{}, []error, *ApiError) { return metrics, warnings, nil } +func (api *API) deleteSeries(r *http.Request) (interface{}, []error, *ApiError) { + return nil, nil, &ApiError{errorBadData, errors.New("delete_series is not implemented yet")} +} + func Respond(w http.ResponseWriter, data interface{}, warnings []error) { w.Header().Set("Content-Type", "application/json") if len(warnings) > 0 { diff --git a/pkg/query/api/v1_test.go b/pkg/query/api/v1_test.go index c400e3b4e76..462cb4b1adf 100644 --- a/pkg/query/api/v1_test.go +++ b/pkg/query/api/v1_test.go @@ -786,6 +786,13 @@ func TestEndpoints(t *testing.T) { errType: errorBadData, method: http.MethodPost, }, + // deleteSeries should return bad request. + { + endpoint: api.deleteSeries, + query: url.Values{}, + method: http.MethodPost, + errType: errorBadData, + }, } for _, test := range tests { @@ -1095,44 +1102,44 @@ func TestParseDownsamplingParamMillis(t *testing.T) { { maxSourceResolutionParam: "0s", enableAutodownsampling: false, - step: time.Hour, - result: int64(compact.ResolutionLevelRaw), - fail: false, + step: time.Hour, + result: int64(compact.ResolutionLevelRaw), + fail: false, }, { maxSourceResolutionParam: "5m", - step: time.Hour, - enableAutodownsampling: false, - result: int64(compact.ResolutionLevel5m), - fail: false, + step: time.Hour, + enableAutodownsampling: false, + result: int64(compact.ResolutionLevel5m), + fail: false, }, { maxSourceResolutionParam: "1h", - step: time.Hour, - enableAutodownsampling: false, - result: int64(compact.ResolutionLevel1h), - fail: false, + step: time.Hour, + enableAutodownsampling: false, + result: int64(compact.ResolutionLevel1h), + fail: false, }, { maxSourceResolutionParam: "", enableAutodownsampling: true, - step: time.Hour, - result: int64(time.Hour / (5 * 1000 * 1000)), - fail: false, + step: time.Hour, + result: int64(time.Hour / (5 * 1000 * 1000)), + fail: false, }, { maxSourceResolutionParam: "", enableAutodownsampling: true, - step: time.Hour, - result: int64((1 * time.Hour) / 6), - fail: true, + step: time.Hour, + result: int64((1 * time.Hour) / 6), + fail: true, }, { maxSourceResolutionParam: "", enableAutodownsampling: true, - step: time.Hour, - result: int64((1 * time.Hour) / 6), - fail: true, + step: time.Hour, + result: int64((1 * time.Hour) / 6), + fail: true, }, }