Skip to content

Commit f523a71

Browse files
committed
id errors 6
Signed-off-by: Arjun Raja Yogidas <[email protected]>
1 parent 7f18572 commit f523a71

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

cmd/nerdctl/container/container_inspect_linux_test.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package container
1818

1919
import (
20+
"encoding/json"
2021
"fmt"
2122
"strings"
2223
"testing"
@@ -62,12 +63,18 @@ func TestContainerInspectContainsMounts(t *testing.T) {
6263
"--name", testContainer,
6364
"--network", "none",
6465
"-v", "/anony-vol",
66+
"--tmpfs", "/app1:size=64m",
6567
"--mount", "type=bind,src=/tmp,dst=/app2,ro",
6668
"--mount", fmt.Sprintf("type=volume,src=%s,dst=/app3,readonly=false", testVolume),
6769
testutil.NginxAlpineImage).AssertOK()
6870

6971
inspect := base.InspectContainer(testContainer)
70-
t.Logf("inspect in TestContainerInspectContainsMounts: %+v", inspect)
72+
inspectJSON, err := json.MarshalIndent(inspect, "", " ")
73+
if err != nil {
74+
t.Errorf("Failed to marshal inspect: %v", err)
75+
} else {
76+
t.Logf("inspect in TestContainerInspectContainsMounts:\n%s", string(inspectJSON))
77+
}
7178
t.Logf("inspect.Mounts in TestContainerInspectContainsMounts: %+v", inspect.Mounts)
7279
// convert array to map to get by key of Destination
7380
actual := make(map[string]dockercompat.MountPoint)

pkg/inspecttypes/dockercompat/dockercompat.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,9 @@ func ContainerFromNative(n *native.Container) (*Container, error) {
347347
tmpfsMounts = filterTmpfsMounts(mounts)
348348
}
349349
}
350-
c.HostConfig.Tmpfs = tmpfsMounts
350+
if len(tmpfsMounts) > 0 {
351+
c.HostConfig.Tmpfs = tmpfsMounts
352+
}
351353

352354
if nedctlExtraHosts := n.Labels[labels.ExtraHosts]; nedctlExtraHosts != "" {
353355
c.HostConfig.ExtraHosts = parseExtraHosts(nedctlExtraHosts)

0 commit comments

Comments
 (0)