@@ -63,36 +63,27 @@ func TestNewPProfServer(t *testing.T) {
63
63
}
64
64
runtime .SetMutexProfileFraction (tt .expectedMutexFraction ) // Reset to the expected value
65
65
66
- urls := []string {
67
- "http://" + server .addr + "/debug/pprof/" ,
68
- "http://" + server .addr + "/debug/pprof/heap" ,
69
- "http://" + server .addr + "/debug/pprof/goroutine" ,
70
- "http://" + server .addr + "/debug/pprof/threadcreate" ,
71
- "http://" + server .addr + "/debug/pprof/block" ,
72
- "http://" + server .addr + "/debug/pprof/mutex" ,
73
- }
74
-
75
- // Perform HTTP GET requests to ensure the server is running and all handlers respond correctly
66
+ // Perform HTTP GET request to the root path
67
+ url := "http://" + server .addr + "/debug/pprof/"
76
68
client := & http.Client {}
77
- for _ , url := range urls {
78
- t .Run ("GET " + url , func (t * testing.T ) {
79
- req , err := http .NewRequest ("GET" , url , nil )
80
- if err != nil {
81
- t .Errorf ("http.NewRequest(%s) error = %v" , url , err )
82
- }
83
-
84
- resp , err := client .Do (req )
85
- if err != nil {
86
- t .Errorf ("http.Client.Do() error = %v" , err )
87
- }
88
-
89
- if resp .StatusCode != http .StatusOK {
90
- t .Errorf ("http.Client.Do() status = %v, want %v" , resp .StatusCode , http .StatusOK )
91
- }
92
-
93
- resp .Body .Close ()
94
- })
95
- }
69
+
70
+ t .Run ("GET " + url , func (t * testing.T ) {
71
+ req , err := http .NewRequest ("GET" , url , nil )
72
+ if err != nil {
73
+ t .Errorf ("http.NewRequest(%s) error = %v" , url , err )
74
+ }
75
+
76
+ resp , err := client .Do (req )
77
+ if err != nil {
78
+ t .Errorf ("http.Client.Do() error = %v" , err )
79
+ }
80
+
81
+ if resp .StatusCode != http .StatusOK {
82
+ t .Errorf ("http.Client.Do() status = %v, want %v" , resp .StatusCode , http .StatusOK )
83
+ }
84
+
85
+ resp .Body .Close ()
86
+ })
96
87
97
88
// Stop the server
98
89
server .Stop (nil )
0 commit comments