File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1422,6 +1422,33 @@ func TestAllocRunner_Restore_LifecycleHooks(t *testing.T) {
14221422 tasklifecycle .RequireTaskAllowed (t , ar2 .taskCoordinator , ar2 .tasks ["poststart" ].Task ())
14231423}
14241424
1425+ // TestAllocRunner_Restore_MissingAllocDir asserts that Restore() fails when the
1426+ // allocation directory is missing, which can happen if allocation storage is
1427+ // ephemeral (e.g., tmpfs or cloud local SSDs).
1428+ func TestAllocRunner_Restore_MissingAllocDir (t * testing.T ) {
1429+ ci .Parallel (t )
1430+
1431+ alloc := mock .Alloc ()
1432+ conf , cleanup := testAllocRunnerConfig (t , alloc )
1433+ defer cleanup ()
1434+
1435+ arIface , err := NewAllocRunner (conf )
1436+ must .NoError (t , err )
1437+ ar := arIface .(* allocRunner )
1438+
1439+ // Get the allocation directory path before deleting it
1440+ allocDirPath := ar .allocDir .AllocDirPath ()
1441+
1442+ // Remove the allocation directory to simulate ephemeral storage being deleted
1443+ err = os .RemoveAll (allocDirPath )
1444+ must .NoError (t , err )
1445+
1446+ // Call Restore() and verify it fails with appropriate error
1447+ err = ar .Restore ()
1448+ must .Error (t , err )
1449+ must .ErrorIs (t , err , os .ErrNotExist )
1450+ }
1451+
14251452func TestAllocRunner_Update_Semantics (t * testing.T ) {
14261453 ci .Parallel (t )
14271454 require := require .New (t )
You can’t perform that action at this time.
0 commit comments