Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3e5fc2b

Browse files
committed
moved tests back to the right package
1 parent 51c97c1 commit 3e5fc2b

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

coderd/httpmw/prometheus_internal_test.go renamed to coderd/httpmw/prometheus_test.go

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package httpmw
1+
package httpmw_test
22

33
import (
44
"context"
@@ -12,6 +12,7 @@ import (
1212
"github.com/stretchr/testify/assert"
1313
"github.com/stretchr/testify/require"
1414

15+
"github.com/coder/coder/v2/coderd/httpmw"
1516
"github.com/coder/coder/v2/coderd/tracing"
1617
"github.com/coder/coder/v2/testutil"
1718
"github.com/coder/websocket"
@@ -39,7 +40,7 @@ func TestPrometheus(t *testing.T) {
3940
req = req.WithContext(context.WithValue(req.Context(), chi.RouteCtxKey, chi.NewRouteContext()))
4041
res := &tracing.StatusWriter{ResponseWriter: httptest.NewRecorder()}
4142
reg := prometheus.NewRegistry()
42-
Prometheus(reg)(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
43+
httpmw.Prometheus(reg)(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
4344
w.WriteHeader(http.StatusOK)
4445
})).ServeHTTP(res, req)
4546
metrics, err := reg.Gather()
@@ -54,7 +55,7 @@ func TestPrometheus_Concurrent(t *testing.T) {
5455
defer cancel()
5556

5657
reg := prometheus.NewRegistry()
57-
promMW := Prometheus(reg)
58+
promMW := httpmw.Prometheus(reg)
5859

5960
// Create a test handler to simulate a WebSocket connection
6061
testHandler := http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
@@ -93,7 +94,7 @@ func TestPrometheus_Concurrent(t *testing.T) {
9394
func TestGetRoutePattern_UserRoute(t *testing.T) {
9495
t.Parallel()
9596
reg := prometheus.NewRegistry()
96-
promMW := Prometheus(reg)
97+
promMW := httpmw.Prometheus(reg)
9798

9899
r := chi.NewRouter()
99100
r.With(promMW).Get("/api/v2/users/{user}", func(w http.ResponseWriter, r *http.Request) {})

0 commit comments

Comments
 (0)