Skip to content

Commit

Permalink
Fix wrong log message & some tests
Browse files Browse the repository at this point in the history
Signed-off-by: Min Uk Lee <minuk.dev@gmail.com>
  • Loading branch information
minuk-dev committed Feb 2, 2024
1 parent b1a3617 commit 75ba518
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions cmd/nerdctl/container_restart_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@ func TestRestartIPCContainer(t *testing.T) {

const shmSize = "32m"
baseContainerName := testutil.Identifier(t)
base.Cmd("run", "-d", "--shm-size", shmSize, "--ipc", "shareable", "--name", baseContainerName, testutil.AlpineImage, "sleep", "infinity").AssertOK()
defer base.Cmd("rm", "-f", baseContainerName).Run()
base.Cmd("run", "-d", "--shm-size", shmSize, "--ipc", "shareable", "--name", baseContainerName, testutil.AlpineImage, "sleep", "infinity").AssertOK()

sharedContainerName := fmt.Sprintf("%s-shared", baseContainerName)
base.Cmd("run", "-d", "--name", sharedContainerName, fmt.Sprintf("--ipc=container:%s", baseContainerName), testutil.AlpineImage, "sleep", "infinity").AssertOK()
defer base.Cmd("rm", "-f", sharedContainerName).Run()
base.Cmd("run", "-d", "--name", sharedContainerName, fmt.Sprintf("--ipc=container:%s", baseContainerName), testutil.AlpineImage, "sleep", "infinity").AssertOK()

base.Cmd("stop", baseContainerName).Run()
base.Cmd("stop", sharedContainerName).Run()
Expand Down
4 changes: 1 addition & 3 deletions cmd/nerdctl/container_run_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,7 @@ func TestRunIPCShareableRemoveMount(t *testing.T) {
container := testutil.Identifier(t)

base.Cmd("run", "--name", container, "--ipc", "shareable", testutil.AlpineImage, "sleep", "0").AssertOK()
result := base.Cmd("rm", container).Run()
fmt.Println(result.Stdout())
fmt.Println(result.Stderr()) // time="2023-12-03T12:53:17Z" level=warning msg="failed to remove container state dir ~/.local/share/nerdctl/1935db59/containers/nerdctl-test/cc44924f9b1af6cd22f599c1bb11303b82b7dd076ce09777b048bda84e744b7e" error="<nil>"
base.Cmd("rm", container).AssertOK()
}

func TestRunIPCContainerNotExists(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/containerutil/containerutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ func Stop(ctx context.Context, container containerd.Container, timeout *time.Dur
// defer umount
defer func() {
if err := ipcutil.CleanUp(ipc); err != nil {
log.G(ctx).Warnf("failed to clean up IPC container %s: %s", container.ID(), err)
log.G(ctx).Warnf("failed to clean up IPC container %s: %s", container.ID(), err)
}
}()

Expand Down

0 comments on commit 75ba518

Please sign in to comment.