@@ -20,7 +20,7 @@ import (
2020
2121func Test_Lazy_Project_Config_Resolution (t * testing.T ) {
2222 t .Parallel ()
23- ctx := context . Background ()
23+ ctx := t . Context ()
2424 container := ioc .NewNestedContainer (nil )
2525 ioc .RegisterInstance (container , ctx )
2626
@@ -90,7 +90,7 @@ func Test_Lazy_Project_Config_Resolution(t *testing.T) {
9090
9191func Test_Lazy_AzdContext_Resolution (t * testing.T ) {
9292 t .Parallel ()
93- ctx := context . Background ()
93+ ctx := t . Context ()
9494 container := ioc .NewNestedContainer (nil )
9595 ioc .RegisterInstance (container , ctx )
9696
@@ -200,7 +200,7 @@ func Test_workflowCmdAdapter_ContextPropagation(t *testing.T) {
200200
201201 // In production, main.go wraps with context.WithoutCancel.
202202 // Simulate this by using a non-cancellable context.
203- ctx := context .WithoutCancel (context . Background ())
203+ ctx := context .WithoutCancel (t . Context ())
204204 err := adapter .ExecuteContext (ctx , []string {"sub" })
205205 require .NoError (t , err )
206206 require .Len (t , receivedContexts , 1 , "Execution should have received context" )
@@ -257,7 +257,7 @@ func Test_workflowCmdAdapter_ContextPropagation(t *testing.T) {
257257 adapter := & workflowCmdAdapter {newCommand : newCommand }
258258
259259 // In production, main.go wraps with context.WithoutCancel.
260- ctx := context .WithoutCancel (context . Background ())
260+ ctx := context .WithoutCancel (t . Context ())
261261 err := adapter .ExecuteContext (ctx , []string {"parent" , "child" })
262262 require .NoError (t , err )
263263 require .Len (t , receivedContexts , 1 )
@@ -300,7 +300,7 @@ func Test_workflowCmdAdapter_ContextPropagation(t *testing.T) {
300300 }
301301
302302 adapter := & workflowCmdAdapter {newCommand : newCommand }
303- ctx := context .WithoutCancel (context . Background ())
303+ ctx := context .WithoutCancel (t . Context ())
304304
305305 err := adapter .ExecuteContext (ctx , []string {"test" })
306306 require .NoError (t , err )
@@ -357,7 +357,7 @@ func Test_workflowCmdAdapter_ContextPropagation(t *testing.T) {
357357 globalArgs : globalArgs ,
358358 }
359359
360- err := adapter .ExecuteContext (context .WithoutCancel (context . Background ()), []string {"package" , "--all" })
360+ err := adapter .ExecuteContext (context .WithoutCancel (t . Context ()), []string {"package" , "--all" })
361361 require .NoError (t , err )
362362 require .True (t , debugEnabled , "global --debug flag should still be parsed on the rebuilt tree" )
363363 require .Empty (t , capturedPositionalArgs ,
@@ -368,7 +368,7 @@ func Test_workflowCmdAdapter_ContextPropagation(t *testing.T) {
368368 // Verify that building a real command tree via NewRootCmd preserves
369369 // the full middleware chain (debug, ux, telemetry, error, loginGuard, etc.)
370370 container := ioc .NewNestedContainer (nil )
371- ctx := context .WithoutCancel (context . Background ())
371+ ctx := context .WithoutCancel (t . Context ())
372372 ioc .RegisterInstance (container , ctx )
373373 ioc .RegisterInstance (container , & internal.GlobalCommandOptions {})
374374
@@ -437,7 +437,7 @@ func Test_workflowCmdAdapter_ContextPropagation(t *testing.T) {
437437 }
438438
439439 adapter := & workflowCmdAdapter {newCommand : newCommand }
440- ctx := context .WithoutCancel (context . Background ())
440+ ctx := context .WithoutCancel (t . Context ())
441441
442442 // Execute "provision" through the adapter (simulates workflow step)
443443 err := adapter .ExecuteContext (ctx , []string {"provision" })
@@ -476,7 +476,7 @@ func Test_workflowCmdAdapter_ContextPropagation(t *testing.T) {
476476 }
477477
478478 adapter := & workflowCmdAdapter {newCommand : newCommand }
479- ctx := context .WithoutCancel (context . Background ())
479+ ctx := context .WithoutCancel (t . Context ())
480480
481481 // Simulate the default "up" workflow steps
482482 steps := [][]string {
@@ -511,7 +511,7 @@ func Test_NewRootCmd_ReregistrationReplacesProjectConfig(t *testing.T) {
511511 // 6. Use newRootCmdWithoutRegistration instead, validate handler is preserved (proving the fix)
512512
513513 container := ioc .NewNestedContainer (nil )
514- ctx := context .WithoutCancel (context . Background ())
514+ ctx := context .WithoutCancel (t . Context ())
515515 ioc .RegisterInstance (container , ctx )
516516 ioc .RegisterInstance (container , & internal.GlobalCommandOptions {})
517517
0 commit comments