Skip to content

Commit c6343c3

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

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
@@ -782,7 +782,7 @@ func TestCreateContainerWithSameName_Isolated(t *testing.T) {
782782
testCreateContainerWithSameName(t, vmID)
783783
}
784784

785-
func TestCreateTooManyContainers_Isolated(t *testing.T) {
785+
func TestStubDriveReserveAndReleaseByContainers_Isolated(t *testing.T) {
786786
prepareIntegTest(t)
787787

788788
assert := assert.New(t)
@@ -825,13 +825,9 @@ func TestCreateTooManyContainers_Isolated(t *testing.T) {
825825
require.NoError(t, err, "failed to delete a container")
826826
}()
827827

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

837833
func TestDriveMount_Isolated(t *testing.T) {

0 commit comments

Comments
 (0)