Skip to content

Commit e2eb4ac

Browse files
committed
Changed TestCreateTooManyContainers test and changed Patch drive path
Signed-off-by: bpopovschi <[email protected]>
1 parent c9f8f29 commit e2eb4ac

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

runtime/drive_handler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ func (h *StubDriveHandler) Release(
162162
return errors.Wrap(err, "failed to unmount drive")
163163
}
164164

165-
err = machine.UpdateGuestDrive(requestCtx, drive.driveID, drive.stubPath)
165+
err = machine.UpdateGuestDrive(requestCtx, drive.driveID, filepath.Base(drive.stubPath))
166166
if err != nil {
167167
return errors.Wrap(err, "failed to patch drive")
168168
}

runtime/service_integ_test.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,7 @@ func TestCreateContainerWithSameName_Isolated(t *testing.T) {
764764
testCreateContainerWithSameName(t, vmID)
765765
}
766766

767-
func TestCreateTooManyContainers_Isolated(t *testing.T) {
767+
func TestStubDriveReserveAndReleaseByContainers_Isolated(t *testing.T) {
768768
prepareIntegTest(t)
769769

770770
assert := assert.New(t)
@@ -807,13 +807,9 @@ func TestCreateTooManyContainers_Isolated(t *testing.T) {
807807
require.NoError(t, err, "failed to delete a container")
808808
}()
809809

810-
var stdout bytes.Buffer
811-
var stderr bytes.Buffer
812-
813-
// When we reuse a VM explicitly, we cannot start multiple containers unless we pre-allocate stub drives.
814-
_, err = c2.NewTask(ctx, cio.NewCreator(cio.WithStreams(nil, &stdout, &stderr)))
815-
assert.Contains(err.Error(), "There are no remaining drives to be used")
816-
require.Error(t, err)
810+
// With the new behaviour, on previous task deletion, stub drive will be released
811+
// and now can be reused by new container and task.
812+
assert.Equal("hello", startAndWaitTask(ctx, t, c2))
817813
}
818814

819815
func TestDriveMount_Isolated(t *testing.T) {

0 commit comments

Comments
 (0)