@@ -137,6 +137,11 @@ func (suite *FakeInputSuite) TestManager_Features() {
137137 },
138138 },
139139 }
140+ runPath := paths .Run ()
141+ require .NoError (t , comp .PrepareWorkDir (runPath ))
142+ t .Cleanup (func () {
143+ assert .NoError (t , comp .RemoveWorkDir (runPath ))
144+ })
140145
141146 subscriptionCtx , subCancel := context .WithCancel (context .Background ())
142147 defer subCancel ()
@@ -337,6 +342,11 @@ func (suite *FakeInputSuite) TestManager_APM() {
337342 },
338343 },
339344 }
345+ runPath := paths .Run ()
346+ require .NoError (t , comp .PrepareWorkDir (runPath ))
347+ t .Cleanup (func () {
348+ assert .NoError (t , comp .RemoveWorkDir (runPath ))
349+ })
340350
341351 subscriptionCtx , subCancel := context .WithCancel (context .Background ())
342352 defer subCancel ()
@@ -609,6 +619,12 @@ func (suite *FakeInputSuite) TestManager_Limits() {
609619 Units : []component.Unit {},
610620 }
611621
622+ runPath := paths .Run ()
623+ require .NoError (t , comp .PrepareWorkDir (runPath ))
624+ t .Cleanup (func () {
625+ assert .NoError (t , comp .RemoveWorkDir (runPath ))
626+ })
627+
612628 subscriptionCtx , subCancel := context .WithCancel (context .Background ())
613629 defer subCancel ()
614630 subscriptionErrCh := make (chan error )
@@ -773,6 +789,12 @@ func (suite *FakeInputSuite) TestManager_BadUnitToGood() {
773789 },
774790 }
775791
792+ runPath := paths .Run ()
793+ require .NoError (t , comp .PrepareWorkDir (runPath ))
794+ t .Cleanup (func () {
795+ assert .NoError (t , comp .RemoveWorkDir (runPath ))
796+ })
797+
776798 subCtx , subCancel := context .WithCancel (context .Background ())
777799 defer subCancel ()
778800 subErrCh := make (chan error )
@@ -950,6 +972,14 @@ func (suite *FakeInputSuite) TestManager_GoodUnitToBad() {
950972 }
951973 goodUnitKey := ComponentUnitKey {UnitType : client .UnitTypeInput , UnitID : "good-input" }
952974
975+ runPath := paths .Run ()
976+ for _ , comp := range []component.Component {healthyComp , unhealthyComp } {
977+ require .NoError (t , comp .PrepareWorkDir (runPath ))
978+ t .Cleanup (func () {
979+ assert .NoError (t , comp .RemoveWorkDir (runPath ))
980+ })
981+ }
982+
953983 // Wait for Manager to start up
954984 timedWaitForReady (t , m , 1 * time .Second )
955985
@@ -1068,6 +1098,7 @@ func noDeadlockTestComponent(t *testing.T, index int) component.Component {
10681098}
10691099
10701100func (suite * FakeInputSuite ) TestManager_NoDeadlock () {
1101+ runPath := paths .Run ()
10711102 t := suite .T ()
10721103 // NOTE: This is a long-running test that spams the runtime managers `Update` function to try and
10731104 // trigger a deadlock. This test takes 2 minutes to run trying to re-produce issue:
@@ -1106,6 +1137,10 @@ func (suite *FakeInputSuite) TestManager_NoDeadlock() {
11061137 defer close (updateResultChan )
11071138 for i := 0 ; updateLoopCtx .Err () == nil ; i ++ {
11081139 comp := noDeadlockTestComponent (t , i )
1140+ require .NoError (t , comp .PrepareWorkDir (runPath ))
1141+ t .Cleanup (func () {
1142+ assert .NoError (t , comp .RemoveWorkDir (runPath ))
1143+ })
11091144 m .Update (component.Model {Components : []component.Component {comp }})
11101145 err := <- m .errCh
11111146 updateResultChan <- err
@@ -1194,6 +1229,11 @@ func (suite *FakeInputSuite) TestManager_Configure() {
11941229 },
11951230 },
11961231 }
1232+ runPath := paths .Run ()
1233+ require .NoError (t , comp .PrepareWorkDir (runPath ))
1234+ t .Cleanup (func () {
1235+ assert .NoError (t , comp .RemoveWorkDir (runPath ))
1236+ })
11971237
11981238 subCtx , subCancel := context .WithCancel (context .Background ())
11991239 defer subCancel ()
@@ -1327,6 +1367,11 @@ func (suite *FakeInputSuite) TestManager_RemoveUnit() {
13271367 },
13281368 },
13291369 }
1370+ runPath := paths .Run ()
1371+ require .NoError (t , comp .PrepareWorkDir (runPath ))
1372+ t .Cleanup (func () {
1373+ assert .NoError (t , comp .RemoveWorkDir (runPath ))
1374+ })
13301375
13311376 subCtx , subCancel := context .WithCancel (context .Background ())
13321377 defer subCancel ()
@@ -1474,6 +1519,11 @@ func (suite *FakeInputSuite) TestManager_ActionState() {
14741519 },
14751520 },
14761521 }
1522+ runPath := paths .Run ()
1523+ require .NoError (t , comp .PrepareWorkDir (runPath ))
1524+ t .Cleanup (func () {
1525+ assert .NoError (t , comp .RemoveWorkDir (runPath ))
1526+ })
14771527
14781528 subCtx , subCancel := context .WithCancel (context .Background ())
14791529 defer subCancel ()
@@ -1600,6 +1650,11 @@ func (suite *FakeInputSuite) TestManager_Restarts() {
16001650 },
16011651 },
16021652 }
1653+ runPath := paths .Run ()
1654+ require .NoError (t , comp .PrepareWorkDir (runPath ))
1655+ t .Cleanup (func () {
1656+ assert .NoError (t , comp .RemoveWorkDir (runPath ))
1657+ })
16031658
16041659 subCtx , subCancel := context .WithCancel (context .Background ())
16051660 defer subCancel ()
@@ -1744,6 +1799,11 @@ func (suite *FakeInputSuite) TestManager_Restarts_ConfigKill() {
17441799 },
17451800 },
17461801 }
1802+ runPath := paths .Run ()
1803+ require .NoError (t , comp .PrepareWorkDir (runPath ))
1804+ t .Cleanup (func () {
1805+ assert .NoError (t , comp .RemoveWorkDir (runPath ))
1806+ })
17471807
17481808 subCtx , subCancel := context .WithCancel (context .Background ())
17491809 defer subCancel ()
@@ -1890,6 +1950,11 @@ func (suite *FakeInputSuite) TestManager_KeepsRestarting() {
18901950 },
18911951 },
18921952 }
1953+ runPath := paths .Run ()
1954+ require .NoError (t , comp .PrepareWorkDir (runPath ))
1955+ t .Cleanup (func () {
1956+ assert .NoError (t , comp .RemoveWorkDir (runPath ))
1957+ })
18931958
18941959 subCtx , subCancel := context .WithCancel (context .Background ())
18951960 defer subCancel ()
@@ -2036,6 +2101,11 @@ func (suite *FakeInputSuite) TestManager_RestartsOnMissedCheckins() {
20362101 },
20372102 },
20382103 }
2104+ runPath := paths .Run ()
2105+ require .NoError (t , comp .PrepareWorkDir (runPath ))
2106+ t .Cleanup (func () {
2107+ assert .NoError (t , comp .RemoveWorkDir (runPath ))
2108+ })
20392109
20402110 subCtx , subCancel := context .WithCancel (context .Background ())
20412111 defer subCancel ()
@@ -2145,6 +2215,11 @@ func (suite *FakeInputSuite) TestManager_InvalidAction() {
21452215 },
21462216 },
21472217 }
2218+ runPath := paths .Run ()
2219+ require .NoError (t , comp .PrepareWorkDir (runPath ))
2220+ t .Cleanup (func () {
2221+ assert .NoError (t , comp .RemoveWorkDir (runPath ))
2222+ })
21482223
21492224 subCtx , subCancel := context .WithCancel (context .Background ())
21502225 defer subCancel ()
@@ -2358,6 +2433,13 @@ func (suite *FakeInputSuite) TestManager_MultiComponent() {
23582433 },
23592434 },
23602435 }
2436+ runPath := paths .Run ()
2437+ for _ , c := range components {
2438+ require .NoError (t , c .PrepareWorkDir (runPath ))
2439+ t .Cleanup (func () {
2440+ assert .NoError (t , c .RemoveWorkDir (runPath ))
2441+ })
2442+ }
23612443
23622444 subCtx , subCancel := context .WithCancel (context .Background ())
23632445 defer subCancel ()
@@ -2485,6 +2567,11 @@ func (suite *FakeInputSuite) TestManager_LogLevel() {
24852567 },
24862568 },
24872569 }
2570+ runPath := paths .Run ()
2571+ require .NoError (t , comp .PrepareWorkDir (runPath ))
2572+ t .Cleanup (func () {
2573+ assert .NoError (t , comp .RemoveWorkDir (runPath ))
2574+ })
24882575
24892576 subCtx , subCancel := context .WithCancel (context .Background ())
24902577 defer subCancel ()
@@ -2687,6 +2774,19 @@ func (suite *FakeInputSuite) TestManager_StartStopComponent() {
26872774 },
26882775 },
26892776 }
2777+ runPath := paths .Run ()
2778+ for _ , c := range components {
2779+ require .NoError (t , c .PrepareWorkDir (runPath ))
2780+ t .Cleanup (func () {
2781+ assert .NoError (t , c .RemoveWorkDir (runPath ))
2782+ })
2783+ }
2784+ for _ , c := range components2 {
2785+ require .NoError (t , c .PrepareWorkDir (runPath ))
2786+ t .Cleanup (func () {
2787+ assert .NoError (t , c .RemoveWorkDir (runPath ))
2788+ })
2789+ }
26902790
26912791 select {
26922792 case err := <- managerErrCh :
@@ -2834,6 +2934,12 @@ func (suite *FakeInputSuite) TestManager_Chunk() {
28342934 Units : units ,
28352935 }
28362936
2937+ runPath := paths .Run ()
2938+ require .NoError (t , comp .PrepareWorkDir (runPath ))
2939+ t .Cleanup (func () {
2940+ assert .NoError (t , comp .RemoveWorkDir (runPath ))
2941+ })
2942+
28372943 waitCtx , waitCancel := context .WithTimeout (ctx , 1 * time .Second )
28382944 defer waitCancel ()
28392945 if err := waitForReady (waitCtx , m ); err != nil {
@@ -2912,8 +3018,6 @@ LOOP:
29123018
29133019 err = <- errCh
29143020 require .NoError (t , err )
2915-
2916- require .DirExists (t , comp .WorkDirPath (paths .Run ()))
29173021}
29183022
29193023func signalState (subErrCh chan error , state * ComponentState , acceptableStates []client.UnitState ) {
0 commit comments