@@ -64,6 +64,7 @@ var _ = Describe("Client", func() {
6464 bbsServer .AppendHandlers (
6565 ghttp .CombineHandlers (
6666 ghttp .VerifyRequest ("POST" , "/v1/actual_lrps/start.r1" ),
67+ ghttp .VerifyHeader (http.Header {"X-Vcap-Request-Id" : []string {"some-trace-id" }}),
6768 ghttp .VerifyProtoRepresenting (& models.StartActualLRPRequest {
6869 ActualLrpKey : & actualLRP .ActualLRPKey ,
6970 ActualLrpInstanceKey : & actualLRP .ActualLRPInstanceKey ,
@@ -75,19 +76,20 @@ var _ = Describe("Client", func() {
7576 ),
7677 )
7778
78- err := internalClient .StartActualLRP (logger , & actualLRP .ActualLRPKey , & actualLRP .ActualLRPInstanceKey , & actualLRP .ActualLRPNetInfo , actualLRP .ActualLrpInternalRoutes , actualLRP .MetricTags )
79+ err := internalClient .StartActualLRP (logger , "some-trace-id" , & actualLRP .ActualLRPKey , & actualLRP .ActualLRPInstanceKey , & actualLRP .ActualLRPNetInfo , actualLRP .ActualLrpInternalRoutes , actualLRP .MetricTags )
7980 Expect (err ).NotTo (HaveOccurred ())
8081 })
8182
8283 It ("Calls the current endpoint" , func () {
8384 bbsServer .AppendHandlers (
8485 ghttp .CombineHandlers (
8586 ghttp .VerifyRequest ("POST" , "/v1/actual_lrps/start.r1" ),
87+ ghttp .VerifyHeader (http.Header {"X-Vcap-Request-Id" : []string {"some-trace-id" }}),
8688 ghttp .RespondWithProto (200 , & models.ActualLRPLifecycleResponse {Error : nil }),
8789 ),
8890 )
8991
90- err := internalClient .StartActualLRP (logger , & models.ActualLRPKey {}, & models.ActualLRPInstanceKey {}, & models.ActualLRPNetInfo {}, []* models.ActualLRPInternalRoute {}, map [string ]string {})
92+ err := internalClient .StartActualLRP (logger , "some-trace-id" , & models.ActualLRPKey {}, & models.ActualLRPInstanceKey {}, & models.ActualLRPNetInfo {}, []* models.ActualLRPInternalRoute {}, map [string ]string {})
9193 Expect (err ).NotTo (HaveOccurred ())
9294 })
9395
@@ -96,10 +98,12 @@ var _ = Describe("Client", func() {
9698 bbsServer .AppendHandlers (
9799 ghttp .CombineHandlers (
98100 ghttp .VerifyRequest ("POST" , "/v1/actual_lrps/start.r1" ),
101+ ghttp .VerifyHeader (http.Header {"X-Vcap-Request-Id" : []string {"some-trace-id" }}),
99102 ghttp .RespondWith (http .StatusNotFound , nil ),
100103 ),
101104 ghttp .CombineHandlers (
102105 ghttp .VerifyRequest ("POST" , "/v1/actual_lrps/start" ),
106+ ghttp .VerifyHeader (http.Header {"X-Vcap-Request-Id" : []string {"some-trace-id" }}),
103107 ghttp .VerifyProtoRepresenting (& models.StartActualLRPRequest {
104108 ActualLrpKey : & actualLRP .ActualLRPKey ,
105109 ActualLrpInstanceKey : & actualLRP .ActualLRPInstanceKey ,
@@ -111,35 +115,38 @@ var _ = Describe("Client", func() {
111115 ),
112116 )
113117
114- err := internalClient .StartActualLRP (logger , & actualLRP .ActualLRPKey , & actualLRP .ActualLRPInstanceKey , & actualLRP .ActualLRPNetInfo , actualLRP .ActualLrpInternalRoutes , actualLRP .MetricTags )
118+ err := internalClient .StartActualLRP (logger , "some-trace-id" , & actualLRP .ActualLRPKey , & actualLRP .ActualLRPInstanceKey , & actualLRP .ActualLRPNetInfo , actualLRP .ActualLrpInternalRoutes , actualLRP .MetricTags )
115119 Expect (err ).NotTo (HaveOccurred ())
116120 })
117121
118122 It ("Returns an error if the current call returns a non-successful non-404 status code" , func () {
119123 bbsServer .AppendHandlers (
120124 ghttp .CombineHandlers (
121125 ghttp .VerifyRequest ("POST" , "/v1/actual_lrps/start.r1" ),
126+ ghttp .VerifyHeader (http.Header {"X-Vcap-Request-Id" : []string {"some-trace-id" }}),
122127 ghttp .RespondWith (http .StatusForbidden , nil ),
123128 ),
124129 )
125130
126- err := internalClient .StartActualLRP (logger , & models.ActualLRPKey {}, & models.ActualLRPInstanceKey {}, & models.ActualLRPNetInfo {}, []* models.ActualLRPInternalRoute {}, map [string ]string {})
131+ err := internalClient .StartActualLRP (logger , "some-trace-id" , & models.ActualLRPKey {}, & models.ActualLRPInstanceKey {}, & models.ActualLRPNetInfo {}, []* models.ActualLRPInternalRoute {}, map [string ]string {})
127132 Expect (err ).To (MatchError ("Invalid Response with status code: 403" ))
128133 })
129134
130135 It ("Still returns an error if the fallback call fails" , func () {
131136 bbsServer .AppendHandlers (
132137 ghttp .CombineHandlers (
133138 ghttp .VerifyRequest ("POST" , "/v1/actual_lrps/start.r1" ),
139+ ghttp .VerifyHeader (http.Header {"X-Vcap-Request-Id" : []string {"some-trace-id" }}),
134140 ghttp .RespondWith (http .StatusNotFound , nil ),
135141 ),
136142 ghttp .CombineHandlers (
137143 ghttp .VerifyRequest ("POST" , "/v1/actual_lrps/start" ),
144+ ghttp .VerifyHeader (http.Header {"X-Vcap-Request-Id" : []string {"some-trace-id" }}),
138145 ghttp .RespondWith (http .StatusForbidden , nil ),
139146 ),
140147 )
141148
142- err := internalClient .StartActualLRP (logger , & models.ActualLRPKey {}, & models.ActualLRPInstanceKey {}, & models.ActualLRPNetInfo {}, []* models.ActualLRPInternalRoute {}, map [string ]string {})
149+ err := internalClient .StartActualLRP (logger , "some-trace-id" , & models.ActualLRPKey {}, & models.ActualLRPInstanceKey {}, & models.ActualLRPNetInfo {}, []* models.ActualLRPInternalRoute {}, map [string ]string {})
143150 Expect (err ).To (MatchError ("Invalid Response with status code: 403" ))
144151 })
145152 })
@@ -150,6 +157,7 @@ var _ = Describe("Client", func() {
150157 bbsServer .AppendHandlers (
151158 ghttp .CombineHandlers (
152159 ghttp .VerifyRequest ("POST" , "/v1/actual_lrps/evacuate_running.r1" ),
160+ ghttp .VerifyHeader (http.Header {"X-Vcap-Request-Id" : []string {"some-trace-id" }}),
153161 ghttp .VerifyProtoRepresenting (& models.EvacuateRunningActualLRPRequest {
154162 ActualLrpKey : & actualLRP .ActualLRPKey ,
155163 ActualLrpInstanceKey : & actualLRP .ActualLRPInstanceKey ,
@@ -161,18 +169,19 @@ var _ = Describe("Client", func() {
161169 ),
162170 )
163171
164- _ , err := internalClient .EvacuateRunningActualLRP (logger , & actualLRP .ActualLRPKey , & actualLRP .ActualLRPInstanceKey , & actualLRP .ActualLRPNetInfo , actualLRP .ActualLrpInternalRoutes , actualLRP .MetricTags )
172+ _ , err := internalClient .EvacuateRunningActualLRP (logger , "some-trace-id" , & actualLRP .ActualLRPKey , & actualLRP .ActualLRPInstanceKey , & actualLRP .ActualLRPNetInfo , actualLRP .ActualLrpInternalRoutes , actualLRP .MetricTags )
165173 Expect (err ).NotTo (HaveOccurred ())
166174 })
167175 It ("Calls the current endpoint" , func () {
168176 bbsServer .AppendHandlers (
169177 ghttp .CombineHandlers (
170178 ghttp .VerifyRequest ("POST" , "/v1/actual_lrps/evacuate_running.r1" ),
179+ ghttp .VerifyHeader (http.Header {"X-Vcap-Request-Id" : []string {"some-trace-id" }}),
171180 ghttp .RespondWithProto (200 , & models.EvacuationResponse {KeepContainer : true , Error : nil }),
172181 ),
173182 )
174183
175- _ , err := internalClient .EvacuateRunningActualLRP (logger , & models.ActualLRPKey {}, & models.ActualLRPInstanceKey {}, & models.ActualLRPNetInfo {}, []* models.ActualLRPInternalRoute {}, map [string ]string {})
184+ _ , err := internalClient .EvacuateRunningActualLRP (logger , "some-trace-id" , & models.ActualLRPKey {}, & models.ActualLRPInstanceKey {}, & models.ActualLRPNetInfo {}, []* models.ActualLRPInternalRoute {}, map [string ]string {})
176185 Expect (err ).NotTo (HaveOccurred ())
177186 })
178187
@@ -181,10 +190,12 @@ var _ = Describe("Client", func() {
181190 bbsServer .AppendHandlers (
182191 ghttp .CombineHandlers (
183192 ghttp .VerifyRequest ("POST" , "/v1/actual_lrps/evacuate_running.r1" ),
193+ ghttp .VerifyHeader (http.Header {"X-Vcap-Request-Id" : []string {"some-trace-id" }}),
184194 ghttp .RespondWith (http .StatusNotFound , nil ),
185195 ),
186196 ghttp .CombineHandlers (
187197 ghttp .VerifyRequest ("POST" , "/v1/actual_lrps/evacuate_running" ),
198+ ghttp .VerifyHeader (http.Header {"X-Vcap-Request-Id" : []string {"some-trace-id" }}),
188199 ghttp .VerifyProtoRepresenting (& models.EvacuateRunningActualLRPRequest {
189200 ActualLrpKey : & actualLRP .ActualLRPKey ,
190201 ActualLrpInstanceKey : & actualLRP .ActualLRPInstanceKey ,
@@ -196,35 +207,38 @@ var _ = Describe("Client", func() {
196207 ),
197208 )
198209
199- _ , err := internalClient .EvacuateRunningActualLRP (logger , & actualLRP .ActualLRPKey , & actualLRP .ActualLRPInstanceKey , & actualLRP .ActualLRPNetInfo , actualLRP .ActualLrpInternalRoutes , actualLRP .MetricTags )
210+ _ , err := internalClient .EvacuateRunningActualLRP (logger , "some-trace-id" , & actualLRP .ActualLRPKey , & actualLRP .ActualLRPInstanceKey , & actualLRP .ActualLRPNetInfo , actualLRP .ActualLrpInternalRoutes , actualLRP .MetricTags )
200211 Expect (err ).NotTo (HaveOccurred ())
201212 })
202213
203214 It ("Returns an error if the current call returns a non-successful non-404 status code" , func () {
204215 bbsServer .AppendHandlers (
205216 ghttp .CombineHandlers (
206217 ghttp .VerifyRequest ("POST" , "/v1/actual_lrps/evacuate_running.r1" ),
218+ ghttp .VerifyHeader (http.Header {"X-Vcap-Request-Id" : []string {"some-trace-id" }}),
207219 ghttp .RespondWith (http .StatusForbidden , nil ),
208220 ),
209221 )
210222
211- _ , err := internalClient .EvacuateRunningActualLRP (logger , & models.ActualLRPKey {}, & models.ActualLRPInstanceKey {}, & models.ActualLRPNetInfo {}, []* models.ActualLRPInternalRoute {}, map [string ]string {})
223+ _ , err := internalClient .EvacuateRunningActualLRP (logger , "some-trace-id" , & models.ActualLRPKey {}, & models.ActualLRPInstanceKey {}, & models.ActualLRPNetInfo {}, []* models.ActualLRPInternalRoute {}, map [string ]string {})
212224 Expect (err ).To (MatchError ("Invalid Response with status code: 403" ))
213225 })
214226
215227 It ("Still returns an error if the fallback call fails" , func () {
216228 bbsServer .AppendHandlers (
217229 ghttp .CombineHandlers (
218230 ghttp .VerifyRequest ("POST" , "/v1/actual_lrps/evacuate_running.r1" ),
231+ ghttp .VerifyHeader (http.Header {"X-Vcap-Request-Id" : []string {"some-trace-id" }}),
219232 ghttp .RespondWith (http .StatusNotFound , nil ),
220233 ),
221234 ghttp .CombineHandlers (
222235 ghttp .VerifyRequest ("POST" , "/v1/actual_lrps/evacuate_running" ),
236+ ghttp .VerifyHeader (http.Header {"X-Vcap-Request-Id" : []string {"some-trace-id" }}),
223237 ghttp .RespondWith (http .StatusForbidden , nil ),
224238 ),
225239 )
226240
227- _ , err := internalClient .EvacuateRunningActualLRP (logger , & models.ActualLRPKey {}, & models.ActualLRPInstanceKey {}, & models.ActualLRPNetInfo {}, []* models.ActualLRPInternalRoute {}, map [string ]string {})
241+ _ , err := internalClient .EvacuateRunningActualLRP (logger , "some-trace-id" , & models.ActualLRPKey {}, & models.ActualLRPInstanceKey {}, & models.ActualLRPNetInfo {}, []* models.ActualLRPInternalRoute {}, map [string ]string {})
228242 Expect (err ).To (MatchError ("Invalid Response with status code: 403" ))
229243 })
230244 })
@@ -238,6 +252,7 @@ var _ = Describe("Client", func() {
238252 bbsServer .AppendHandlers (
239253 ghttp .CombineHandlers (
240254 ghttp .VerifyRequest ("POST" , "/v1/actual_lrp_groups/list" ),
255+ ghttp .VerifyHeader (http.Header {"X-Vcap-Request-Id" : []string {"some-trace-id" }}),
241256 func (w http.ResponseWriter , req * http.Request ) {
242257 time .Sleep (cfg .RequestTimeout * 2 )
243258 },
@@ -247,7 +262,7 @@ var _ = Describe("Client", func() {
247262 })
248263
249264 It ("respects the request timeout" , func () {
250- _ , err := client .ActualLRPGroups (logger , models.ActualLRPFilter {})
265+ _ , err := client .ActualLRPGroups (logger , "some-trace-id" , models.ActualLRPFilter {})
251266 Expect (err .Error ()).To (ContainSubstring (context .DeadlineExceeded .Error ()))
252267 })
253268 })
@@ -283,6 +298,7 @@ var _ = Describe("Client", func() {
283298 tlsServer .AppendHandlers (
284299 ghttp .CombineHandlers (
285300 ghttp .VerifyRequest ("POST" , "/v1/actual_lrp_groups/list" ),
301+ ghttp .VerifyHeader (http.Header {"X-Vcap-Request-Id" : []string {"some-trace-id" }}),
286302 func (w http.ResponseWriter , req * http.Request ) {
287303 time .Sleep (cfg .RequestTimeout * 2 )
288304 },
@@ -297,7 +313,7 @@ var _ = Describe("Client", func() {
297313 })
298314
299315 It ("respects the request timeout" , func () {
300- _ , err := client .ActualLRPGroups (logger , models.ActualLRPFilter {})
316+ _ , err := client .ActualLRPGroups (logger , "some-trace-id" , models.ActualLRPFilter {})
301317 Expect (err .Error ()).To (ContainSubstring (context .DeadlineExceeded .Error ()))
302318 })
303319 })
@@ -322,6 +338,7 @@ var _ = Describe("Client", func() {
322338 bbsServer .AppendHandlers (
323339 ghttp .CombineHandlers (
324340 ghttp .VerifyRequest ("POST" , "/v1/actual_lrp_groups/list" ),
341+ ghttp .VerifyHeader (http.Header {"X-Vcap-Request-Id" : []string {"some-trace-id" }}),
325342 func (w http.ResponseWriter , req * http.Request ) {
326343 <- blockCh
327344 },
@@ -346,7 +363,7 @@ var _ = Describe("Client", func() {
346363 Eventually (blockCh ).Should (BeSent (struct {}{}))
347364 }()
348365
349- lrps , err := client .ActualLRPGroups (logger , models.ActualLRPFilter {})
366+ lrps , err := client .ActualLRPGroups (logger , "some-trace-id" , models.ActualLRPFilter {})
350367 Expect (err ).ToNot (HaveOccurred ())
351368 Expect (lrps ).To (ConsistOf (& models.ActualLRPGroup {
352369 Instance : & models.ActualLRP {
@@ -361,7 +378,7 @@ var _ = Describe("Client", func() {
361378 })
362379
363380 It ("fails the request with a timeout error" , func () {
364- _ , err := client .ActualLRPGroups (logger , models.ActualLRPFilter {})
381+ _ , err := client .ActualLRPGroups (logger , "some-trace-id" , models.ActualLRPFilter {})
365382 var apiError * models.Error
366383 Expect (err ).To (HaveOccurred ())
367384 Expect (err ).To (BeAssignableToTypeOf (apiError ))
@@ -376,13 +393,14 @@ var _ = Describe("Client", func() {
376393 bbsServer .AppendHandlers (
377394 ghttp .CombineHandlers (
378395 ghttp .VerifyRequest ("POST" , "/v1/actual_lrp_groups/list" ),
396+ ghttp .VerifyHeader (http.Header {"X-Vcap-Request-Id" : []string {"some-trace-id" }}),
379397 ghttp .RespondWith (500 , nil ),
380398 ),
381399 )
382400 })
383401
384402 It ("returns the error" , func () {
385- _ , err := client .ActualLRPGroups (logger , models.ActualLRPFilter {})
403+ _ , err := client .ActualLRPGroups (logger , "some-trace-id" , models.ActualLRPFilter {})
386404 Expect (err ).To (HaveOccurred ())
387405 responseError := err .(* models.Error )
388406 Expect (responseError .Type ).To (Equal (models .Error_InvalidResponse ))
0 commit comments