Skip to content

Commit

Permalink
fix ut
Browse files Browse the repository at this point in the history
Signed-off-by: okJiang <[email protected]>
  • Loading branch information
okJiang committed Aug 9, 2024
1 parent 043ba4d commit 02328b2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion server/api/metric.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type queryMetric struct {
s *server.Server
}

func newQueryMetric(s *server.Server) *queryMetric {
func newqueryMetric(s *server.Server) *queryMetric {
return &queryMetric{s: s}
}

Expand Down
4 changes: 2 additions & 2 deletions server/api/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,8 @@ func createRouter(prefix string, svr *server.Server) *mux.Router {
registerFunc(apiRouter, "/ping", healthHandler.Ping, setMethods(http.MethodGet), setAuditBackend(prometheus))

// metric query use to query metric data, the protocol is compatible with prometheus.
registerFunc(apiRouter, "/metric/query", newQueryMetric(svr).queryMetric, setMethods(http.MethodGet, http.MethodPost), setAuditBackend(prometheus))
registerFunc(apiRouter, "/metric/query_range", newQueryMetric(svr).queryMetric, setMethods(http.MethodGet, http.MethodPost), setAuditBackend(prometheus))
registerFunc(apiRouter, "/metric/query", newqueryMetric(svr).queryMetric, setMethods(http.MethodGet, http.MethodPost), setAuditBackend(prometheus))
registerFunc(apiRouter, "/metric/query_range", newqueryMetric(svr).queryMetric, setMethods(http.MethodGet, http.MethodPost), setAuditBackend(prometheus))

pprofHandler := newPprofHandler(svr, rd)
// profile API
Expand Down
6 changes: 3 additions & 3 deletions server/api/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ func (suite *serviceTestSuite) TestServiceLabels() {
apiutil.NewAccessPath("/pd/api/v1/leader/resign", ""))
re.Equal("", serviceLabel)

accessPaths = suite.svr.GetServiceLabels("QueryMetric")
accessPaths = suite.svr.GetServiceLabels("queryMetric")
re.Len(accessPaths, 4)
sort.Slice(accessPaths, func(i, j int) bool {
if accessPaths[i].Path == accessPaths[j].Path {
Expand All @@ -260,10 +260,10 @@ func (suite *serviceTestSuite) TestServiceLabels() {
re.Equal(http.MethodPost, accessPaths[3].Method)
serviceLabel = suite.svr.GetAPIAccessServiceLabel(
apiutil.NewAccessPath("/pd/api/v1/metric/query", http.MethodPost))
re.Equal("QueryMetric", serviceLabel)
re.Equal("queryMetric", serviceLabel)
serviceLabel = suite.svr.GetAPIAccessServiceLabel(
apiutil.NewAccessPath("/pd/api/v1/metric/query", http.MethodGet))
re.Equal("QueryMetric", serviceLabel)
re.Equal("queryMetric", serviceLabel)
}

func (suite *adminTestSuite) TestCleanPath() {
Expand Down

0 comments on commit 02328b2

Please sign in to comment.