Commit 5307cdc
* feat(mcptest): Change `Server.Start` to accept a `context.Context`.
Previously, `mcptest` used `context.TODO()` as the context with this server
code was executed (with a comment to upgrade to `testing.T.Context()`
eventually.
This effectively prevents tests from preparing a context to be used with server
code. This is imporant, because `WithHTTPContextFunc` and friends appear to be
the intended way to extract things like authentication information from the raw
HTTP request and pass it to the server code. Without this change, such code is
effectively untestable, at least with this package.
The `NewServer` convenience method has been left unchanged (i.e. it does not
accept a context) to avoid breaking users taking the happy path. Chaning the
signature of `Start()` is however a breaking change.
* test(mcptest): Update tests to use the new `Start()` signature.
---------
Co-authored-by: Navendu Pottekkat <navendu@apache.org>
1 parent 4295cec commit 5307cdc
2 files changed
+10
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
28 | 27 | | |
29 | 28 | | |
30 | 29 | | |
| |||
45 | 44 | | |
46 | 45 | | |
47 | 46 | | |
48 | | - | |
| 47 | + | |
| 48 | + | |
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | 62 | | |
69 | 63 | | |
70 | 64 | | |
| |||
114 | 108 | | |
115 | 109 | | |
116 | 110 | | |
117 | | - | |
| 111 | + | |
118 | 112 | | |
119 | 113 | | |
| 114 | + | |
| 115 | + | |
120 | 116 | | |
121 | 117 | | |
122 | 118 | | |
| |||
132 | 128 | | |
133 | 129 | | |
134 | 130 | | |
135 | | - | |
| 131 | + | |
136 | 132 | | |
137 | 133 | | |
138 | 134 | | |
139 | 135 | | |
140 | 136 | | |
141 | | - | |
| 137 | + | |
142 | 138 | | |
143 | 139 | | |
144 | 140 | | |
145 | 141 | | |
146 | 142 | | |
147 | 143 | | |
148 | 144 | | |
149 | | - | |
| 145 | + | |
150 | 146 | | |
151 | 147 | | |
152 | 148 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
112 | | - | |
| 112 | + | |
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
| |||
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
167 | | - | |
| 167 | + | |
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
| |||
0 commit comments