File tree 1 file changed +8
-1
lines changed
1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change 8
8
"net/http"
9
9
"sync"
10
10
"testing"
11
+ "time"
11
12
12
13
"github.com/stretchr/testify/assert"
13
14
"github.com/stretchr/testify/require"
@@ -40,6 +41,13 @@ func TestStreamableHttpTransport(t *testing.T) {
40
41
waitGroup .Wait ()
41
42
}()
42
43
44
+ // addresses race condition between server start and test start
45
+ assert .EventuallyWithT (t , func (c * assert.CollectT ) {
46
+ resp , err := http .Get ("http://localhost:8080/mcp" )
47
+ assert .NoError (c , err )
48
+ defer func () { assert .NoError (c , resp .Body .Close ()) }()
49
+ }, 5 * time .Second , 200 * time .Millisecond )
50
+
43
51
// testing https://spec.modelcontextprotocol.io/specification/2025-03-26/basic/transports/#listening-for-messages-from-the-server
44
52
// for now we only check that the server is responding with 405 as spec says it should when "long-running" SSE is not supported
45
53
t .Run ("GET is not yet supported" , func (t * testing.T ) {
@@ -188,7 +196,6 @@ func TestStreamableHttpTransport(t *testing.T) {
188
196
require .Equal (t , "" , resp .Header .Get ("Content-Type" ))
189
197
require .Equal (t , `` , string (respBody ))
190
198
})
191
-
192
199
}
193
200
194
201
func TestMarshalServerError (t * testing.T ) {
You can’t perform that action at this time.
0 commit comments