Unmount /dev/shm when stop sandbox.

Signed-off-by: Lantao Liu <lantaol@google.com>
This commit is contained in:
Lantao Liu
2017-06-14 01:57:02 +00:00
parent cc43c86f86
commit 7f9e0262ad
5 changed files with 37 additions and 8 deletions

View File

@@ -58,6 +58,7 @@ func TestStopPodSandbox(t *testing.T) {
injectErr error
injectStatErr error
injectCNIErr error
injectUnmountErr error
expectErr bool
expectCalls []string
expectedCNICalls []string
@@ -115,6 +116,15 @@ func TestStopPodSandbox(t *testing.T) {
injectCNIErr: errors.New("arbitrary error"),
expectCalls: []string{},
},
"stop sandbox with unmount error": {
sandboxTasks: []task.Task{testContainer},
injectSandbox: true,
expectErr: true,
expectedCNICalls: []string{"TearDownPod"},
injectCNIErr: errors.New("arbitrary error"),
injectUnmountErr: errors.New("arbitrary error"),
expectCalls: []string{},
},
} {
t.Logf("TestCase %q", desc)
c := newTestCRIContainerdService()
@@ -136,6 +146,9 @@ func TestStopPodSandbox(t *testing.T) {
if test.injectStatErr != nil {
fakeOS.InjectError("Stat", test.injectStatErr)
}
if test.injectUnmountErr != nil {
fakeOS.InjectError("Unmount", test.injectUnmountErr)
}
fakeCNIPlugin.SetFakePodNetwork(testSandbox.NetNS, testSandbox.Config.GetMetadata().GetNamespace(),
testSandbox.Config.GetMetadata().GetName(), testID, sandboxStatusTestIP)