github.com/AbhinandanKurakure/podman/v3@v3.4.10/test/e2e/inspect_test.go (about)

     1  package integration
     2  
     3  import (
     4  	"os"
     5  	"strings"
     6  
     7  	. "github.com/containers/podman/v3/test/utils"
     8  	. "github.com/onsi/ginkgo"
     9  	. "github.com/onsi/gomega"
    10  	. "github.com/onsi/gomega/gexec"
    11  	"github.com/opencontainers/selinux/go-selinux"
    12  )
    13  
    14  var _ = Describe("Podman inspect", func() {
    15  	var (
    16  		tempdir    string
    17  		err        error
    18  		podmanTest *PodmanTestIntegration
    19  	)
    20  
    21  	BeforeEach(func() {
    22  		tempdir, err = CreateTempDirInTempDir()
    23  		if err != nil {
    24  			os.Exit(1)
    25  		}
    26  		podmanTest = PodmanTestCreate(tempdir)
    27  		podmanTest.Setup()
    28  		podmanTest.SeedImages()
    29  	})
    30  
    31  	AfterEach(func() {
    32  		podmanTest.Cleanup()
    33  		f := CurrentGinkgoTestDescription()
    34  		processTestResult(f)
    35  
    36  	})
    37  
    38  	It("podman inspect alpine image", func() {
    39  		session := podmanTest.Podman([]string{"inspect", "--format=json", ALPINE})
    40  		session.WaitWithDefaultTimeout()
    41  		Expect(session).Should(Exit(0))
    42  		Expect(session.IsJSONOutputValid()).To(BeTrue())
    43  		imageData := session.InspectImageJSON()
    44  		Expect(imageData[0].RepoTags[0]).To(Equal("quay.io/libpod/alpine:latest"))
    45  	})
    46  
    47  	It("podman inspect bogus container", func() {
    48  		session := podmanTest.Podman([]string{"inspect", "foobar4321"})
    49  		session.WaitWithDefaultTimeout()
    50  		Expect(session).To(ExitWithError())
    51  	})
    52  
    53  	It("podman inspect filter should work if result contains tab", func() {
    54  		session := podmanTest.Podman([]string{"build", "--tag", "envwithtab", "build/envwithtab"})
    55  		session.WaitWithDefaultTimeout()
    56  		Expect(session).Should(Exit(0))
    57  
    58  		// Verify that OS and Arch are being set
    59  		inspect := podmanTest.Podman([]string{"inspect", "-f", "{{ .Config.Env }}", "envwithtab"})
    60  		inspect.WaitWithDefaultTimeout()
    61  		Expect(inspect).Should(Exit(0))
    62  		// output should not be empty
    63  		// test validates fix for https://github.com/containers/podman/issues/8785
    64  		Expect(strings.Contains(inspect.OutputToString(), "TEST"))
    65  
    66  		session = podmanTest.Podman([]string{"rmi", "envwithtab"})
    67  		session.WaitWithDefaultTimeout()
    68  		Expect(session).Should(Exit(0))
    69  	})
    70  
    71  	It("podman inspect with GO format", func() {
    72  		session := podmanTest.Podman([]string{"inspect", "--format", "{{.ID}}", ALPINE})
    73  		session.WaitWithDefaultTimeout()
    74  		Expect(session).Should(Exit(0))
    75  
    76  		result := podmanTest.Podman([]string{"images", "-q", "--no-trunc", ALPINE})
    77  		result.WaitWithDefaultTimeout()
    78  		Expect(session).Should(Exit(0))
    79  		Expect(strings.Contains(result.OutputToString(), session.OutputToString()))
    80  	})
    81  
    82  	It("podman inspect specified type", func() {
    83  		session := podmanTest.Podman([]string{"inspect", "--type", "image", ALPINE})
    84  		session.WaitWithDefaultTimeout()
    85  		Expect(session).Should(Exit(0))
    86  	})
    87  
    88  	It("podman inspect container with GO format for ConmonPidFile", func() {
    89  		session, ec, _ := podmanTest.RunLsContainer("test1")
    90  		Expect(ec).To(Equal(0))
    91  
    92  		session = podmanTest.Podman([]string{"inspect", "--format", "{{.ConmonPidFile}}", "test1"})
    93  		session.WaitWithDefaultTimeout()
    94  		Expect(session).Should(Exit(0))
    95  	})
    96  
    97  	It("podman inspect container with size", func() {
    98  		_, ec, _ := podmanTest.RunLsContainer("sizetest")
    99  		Expect(ec).To(Equal(0))
   100  
   101  		result := podmanTest.Podman([]string{"inspect", "--size", "sizetest"})
   102  		result.WaitWithDefaultTimeout()
   103  		Expect(result).Should(Exit(0))
   104  		conData := result.InspectContainerToJSON()
   105  		Expect(conData[0].SizeRootFs).To(BeNumerically(">", 0))
   106  		Expect(*conData[0].SizeRw).To(BeNumerically(">=", 0))
   107  	})
   108  
   109  	It("podman inspect container and image", func() {
   110  		ls, ec, _ := podmanTest.RunLsContainer("")
   111  		Expect(ec).To(Equal(0))
   112  		cid := ls.OutputToString()
   113  
   114  		result := podmanTest.Podman([]string{"inspect", "--format={{.ID}}", cid, ALPINE})
   115  		result.WaitWithDefaultTimeout()
   116  		Expect(result).Should(Exit(0))
   117  		Expect(len(result.OutputToStringArray())).To(Equal(2))
   118  	})
   119  
   120  	It("podman inspect container and filter for Image{ID}", func() {
   121  		ls, ec, _ := podmanTest.RunLsContainer("")
   122  		Expect(ec).To(Equal(0))
   123  		cid := ls.OutputToString()
   124  
   125  		result := podmanTest.Podman([]string{"inspect", "--format={{.ImageID}}", cid})
   126  		result.WaitWithDefaultTimeout()
   127  		Expect(result).Should(Exit(0))
   128  		Expect(len(result.OutputToStringArray())).To(Equal(1))
   129  
   130  		result = podmanTest.Podman([]string{"inspect", "--format={{.Image}}", cid})
   131  		result.WaitWithDefaultTimeout()
   132  		Expect(result).Should(Exit(0))
   133  		Expect(len(result.OutputToStringArray())).To(Equal(1))
   134  	})
   135  
   136  	It("podman inspect container and filter for CreateCommand", func() {
   137  		ls, ec, _ := podmanTest.RunLsContainer("")
   138  		Expect(ec).To(Equal(0))
   139  		cid := ls.OutputToString()
   140  
   141  		result := podmanTest.Podman([]string{"inspect", "--format={{.Config.CreateCommand}}", cid})
   142  		result.WaitWithDefaultTimeout()
   143  		Expect(result).Should(Exit(0))
   144  		Expect(len(result.OutputToStringArray())).To(Equal(1))
   145  	})
   146  
   147  	It("podman inspect -l with additional input should fail", func() {
   148  		SkipIfRemote("--latest flag n/a")
   149  		result := podmanTest.Podman([]string{"inspect", "-l", "1234foobar"})
   150  		result.WaitWithDefaultTimeout()
   151  		Expect(result).Should(Exit(125))
   152  	})
   153  
   154  	It("podman inspect with mount filters", func() {
   155  
   156  		ctrSession := podmanTest.Podman([]string{"create", "--name", "test", "-v", "/tmp:/test1", ALPINE, "top"})
   157  		ctrSession.WaitWithDefaultTimeout()
   158  		Expect(ctrSession).Should(Exit(0))
   159  
   160  		inspectSource := podmanTest.Podman([]string{"inspect", "test", "--format", "{{(index .Mounts 0).Source}}"})
   161  		inspectSource.WaitWithDefaultTimeout()
   162  		Expect(inspectSource).Should(Exit(0))
   163  		Expect(inspectSource.OutputToString()).To(Equal("/tmp"))
   164  
   165  		inspectSrc := podmanTest.Podman([]string{"inspect", "test", "--format", "{{(index .Mounts 0).Src}}"})
   166  		inspectSrc.WaitWithDefaultTimeout()
   167  		Expect(inspectSrc).Should(Exit(0))
   168  		Expect(inspectSrc.OutputToString()).To(Equal("/tmp"))
   169  
   170  		inspectDestination := podmanTest.Podman([]string{"inspect", "test", "--format", "{{(index .Mounts 0).Destination}}"})
   171  		inspectDestination.WaitWithDefaultTimeout()
   172  		Expect(inspectDestination).Should(Exit(0))
   173  		Expect(inspectDestination.OutputToString()).To(Equal("/test1"))
   174  
   175  		inspectDst := podmanTest.Podman([]string{"inspect", "test", "--format", "{{(index .Mounts 0).Dst}}"})
   176  		inspectDst.WaitWithDefaultTimeout()
   177  		Expect(inspectDst).Should(Exit(0))
   178  		Expect(inspectDst.OutputToString()).To(Equal("/test1"))
   179  	})
   180  
   181  	It("podman inspect shows healthcheck on docker image", func() {
   182  		podmanTest.AddImageToRWStore(healthcheck)
   183  		session := podmanTest.Podman([]string{"inspect", "--format=json", healthcheck})
   184  		session.WaitWithDefaultTimeout()
   185  		imageData := session.InspectImageJSON()
   186  		Expect(imageData[0].HealthCheck.Timeout).To(BeNumerically("==", 3000000000))
   187  		Expect(imageData[0].HealthCheck.Interval).To(BeNumerically("==", 60000000000))
   188  		Expect(imageData[0].HealthCheck.Test).To(Equal([]string{"CMD-SHELL", "curl -f http://localhost/ || exit 1"}))
   189  	})
   190  
   191  	It("podman inspect --latest with no container fails", func() {
   192  		SkipIfRemote("testing --latest flag")
   193  
   194  		session := podmanTest.Podman([]string{"inspect", "--latest"})
   195  		session.WaitWithDefaultTimeout()
   196  		Expect(session).To(ExitWithError())
   197  	})
   198  
   199  	It("podman [image,container] inspect on image", func() {
   200  		baseInspect := podmanTest.Podman([]string{"inspect", ALPINE})
   201  		baseInspect.WaitWithDefaultTimeout()
   202  		Expect(baseInspect).Should(Exit(0))
   203  		baseJSON := baseInspect.InspectImageJSON()
   204  		Expect(len(baseJSON)).To(Equal(1))
   205  
   206  		ctrInspect := podmanTest.Podman([]string{"container", "inspect", ALPINE})
   207  		ctrInspect.WaitWithDefaultTimeout()
   208  		Expect(ctrInspect).To(ExitWithError())
   209  
   210  		imageInspect := podmanTest.Podman([]string{"image", "inspect", ALPINE})
   211  		imageInspect.WaitWithDefaultTimeout()
   212  		Expect(imageInspect).Should(Exit(0))
   213  		imageJSON := imageInspect.InspectImageJSON()
   214  		Expect(len(imageJSON)).To(Equal(1))
   215  
   216  		Expect(baseJSON[0].ID).To(Equal(imageJSON[0].ID))
   217  	})
   218  
   219  	It("podman [image, container] inspect on container", func() {
   220  		ctrName := "testCtr"
   221  		create := podmanTest.Podman([]string{"create", "--name", ctrName, ALPINE, "sh"})
   222  		create.WaitWithDefaultTimeout()
   223  		Expect(create).Should(Exit(0))
   224  
   225  		baseInspect := podmanTest.Podman([]string{"inspect", ctrName})
   226  		baseInspect.WaitWithDefaultTimeout()
   227  		Expect(baseInspect).Should(Exit(0))
   228  		baseJSON := baseInspect.InspectContainerToJSON()
   229  		Expect(len(baseJSON)).To(Equal(1))
   230  
   231  		ctrInspect := podmanTest.Podman([]string{"container", "inspect", ctrName})
   232  		ctrInspect.WaitWithDefaultTimeout()
   233  		Expect(ctrInspect).Should(Exit(0))
   234  		ctrJSON := ctrInspect.InspectContainerToJSON()
   235  		Expect(len(ctrJSON)).To(Equal(1))
   236  
   237  		imageInspect := podmanTest.Podman([]string{"image", "inspect", ctrName})
   238  		imageInspect.WaitWithDefaultTimeout()
   239  		Expect(imageInspect).To(ExitWithError())
   240  
   241  		Expect(baseJSON[0].ID).To(Equal(ctrJSON[0].ID))
   242  	})
   243  
   244  	It("podman inspect always produces a valid array", func() {
   245  		baseInspect := podmanTest.Podman([]string{"inspect", "doesNotExist"})
   246  		baseInspect.WaitWithDefaultTimeout()
   247  		Expect(baseInspect).To(ExitWithError())
   248  		emptyJSON := baseInspect.InspectContainerToJSON()
   249  		Expect(len(emptyJSON)).To(Equal(0))
   250  	})
   251  
   252  	It("podman inspect one container with not exist returns 1-length valid array", func() {
   253  		ctrName := "testCtr"
   254  		create := podmanTest.Podman([]string{"create", "--name", ctrName, ALPINE, "sh"})
   255  		create.WaitWithDefaultTimeout()
   256  		Expect(create).Should(Exit(0))
   257  
   258  		baseInspect := podmanTest.Podman([]string{"inspect", ctrName, "doesNotExist"})
   259  		baseInspect.WaitWithDefaultTimeout()
   260  		Expect(baseInspect).To(ExitWithError())
   261  		baseJSON := baseInspect.InspectContainerToJSON()
   262  		Expect(len(baseJSON)).To(Equal(1))
   263  		Expect(baseJSON[0].Name).To(Equal(ctrName))
   264  	})
   265  
   266  	It("podman inspect container + image with same name gives container", func() {
   267  		podmanTest.AddImageToRWStore(ALPINE)
   268  		ctrName := "testcontainer"
   269  		create := podmanTest.Podman([]string{"create", "--name", ctrName, ALPINE, "sh"})
   270  		create.WaitWithDefaultTimeout()
   271  		Expect(create).Should(Exit(0))
   272  
   273  		tag := podmanTest.Podman([]string{"tag", ALPINE, ctrName + ":latest"})
   274  		tag.WaitWithDefaultTimeout()
   275  		Expect(tag).Should(Exit(0))
   276  
   277  		baseInspect := podmanTest.Podman([]string{"inspect", ctrName})
   278  		baseInspect.WaitWithDefaultTimeout()
   279  		Expect(baseInspect).Should(Exit(0))
   280  		baseJSON := baseInspect.InspectContainerToJSON()
   281  		Expect(len(baseJSON)).To(Equal(1))
   282  		Expect(baseJSON[0].Name).To(Equal(ctrName))
   283  	})
   284  
   285  	It("podman inspect - HostConfig.SecurityOpt ", func() {
   286  		if !selinux.GetEnabled() {
   287  			Skip("SELinux not enabled")
   288  		}
   289  
   290  		ctrName := "hugo"
   291  		create := podmanTest.Podman([]string{
   292  			"create", "--name", ctrName,
   293  			"--security-opt", "seccomp=unconfined",
   294  			"--security-opt", "label=type:spc_t",
   295  			"--security-opt", "label=level:s0",
   296  			ALPINE, "sh"})
   297  
   298  		create.WaitWithDefaultTimeout()
   299  		Expect(create).Should(Exit(0))
   300  
   301  		baseInspect := podmanTest.Podman([]string{"inspect", ctrName})
   302  		baseInspect.WaitWithDefaultTimeout()
   303  		Expect(baseInspect).Should(Exit(0))
   304  		baseJSON := baseInspect.InspectContainerToJSON()
   305  		Expect(len(baseJSON)).To(Equal(1))
   306  		Expect(baseJSON[0].HostConfig.SecurityOpt).To(Equal([]string{"label=type:spc_t,label=level:s0", "seccomp=unconfined"}))
   307  	})
   308  
   309  	It("podman inspect pod", func() {
   310  		podName := "testpod"
   311  		create := podmanTest.Podman([]string{"pod", "create", "--name", podName})
   312  		create.WaitWithDefaultTimeout()
   313  		Expect(create).Should(Exit(0))
   314  
   315  		inspect := podmanTest.Podman([]string{"inspect", podName})
   316  		inspect.WaitWithDefaultTimeout()
   317  		Expect(inspect).Should(Exit(0))
   318  		Expect(inspect.IsJSONOutputValid()).To(BeTrue())
   319  		podData := inspect.InspectPodArrToJSON()
   320  		Expect(podData[0].Name).To(Equal(podName))
   321  	})
   322  
   323  	It("podman inspect pod with type", func() {
   324  		podName := "testpod"
   325  		create := podmanTest.Podman([]string{"pod", "create", "--name", podName})
   326  		create.WaitWithDefaultTimeout()
   327  		Expect(create).Should(Exit(0))
   328  
   329  		inspect := podmanTest.Podman([]string{"inspect", "--type", "pod", podName})
   330  		inspect.WaitWithDefaultTimeout()
   331  		Expect(inspect).Should(Exit(0))
   332  		Expect(inspect.IsJSONOutputValid()).To(BeTrue())
   333  		podData := inspect.InspectPodArrToJSON()
   334  		Expect(podData[0].Name).To(Equal(podName))
   335  	})
   336  
   337  	It("podman inspect latest pod", func() {
   338  		SkipIfRemote("--latest flag n/a")
   339  		podName := "testpod"
   340  		create := podmanTest.Podman([]string{"pod", "create", "--name", podName})
   341  		create.WaitWithDefaultTimeout()
   342  		Expect(create).Should(Exit(0))
   343  
   344  		inspect := podmanTest.Podman([]string{"inspect", "--type", "pod", "--latest"})
   345  		inspect.WaitWithDefaultTimeout()
   346  		Expect(inspect).Should(Exit(0))
   347  		Expect(inspect.IsJSONOutputValid()).To(BeTrue())
   348  		podData := inspect.InspectPodArrToJSON()
   349  		Expect(podData[0].Name).To(Equal(podName))
   350  	})
   351  	It("podman inspect latest defaults to latest container", func() {
   352  		SkipIfRemote("--latest flag n/a")
   353  		podName := "testpod"
   354  		pod := podmanTest.Podman([]string{"pod", "create", "--name", podName})
   355  		pod.WaitWithDefaultTimeout()
   356  		Expect(pod).Should(Exit(0))
   357  
   358  		inspect1 := podmanTest.Podman([]string{"inspect", "--type", "pod", podName})
   359  		inspect1.WaitWithDefaultTimeout()
   360  		Expect(inspect1).Should(Exit(0))
   361  		Expect(inspect1.IsJSONOutputValid()).To(BeTrue())
   362  		podData := inspect1.InspectPodArrToJSON()
   363  		infra := podData[0].Containers[0].Name
   364  
   365  		inspect := podmanTest.Podman([]string{"inspect", "--latest"})
   366  		inspect.WaitWithDefaultTimeout()
   367  		Expect(inspect).Should(Exit(0))
   368  		Expect(inspect.IsJSONOutputValid()).To(BeTrue())
   369  		containerData := inspect.InspectContainerToJSON()
   370  		Expect(containerData[0].Name).To(Equal(infra))
   371  	})
   372  
   373  	It("podman inspect network", func() {
   374  		name, path := generateNetworkConfig(podmanTest)
   375  		defer removeConf(path)
   376  
   377  		session := podmanTest.Podman([]string{"inspect", name, "--format", "{{.cniVersion}}"})
   378  		session.WaitWithDefaultTimeout()
   379  		Expect(session).Should(Exit(0))
   380  		Expect(session.LineInOutputContains("0.3.0")).To(BeTrue())
   381  	})
   382  
   383  	It("podman inspect a volume", func() {
   384  		session := podmanTest.Podman([]string{"volume", "create", "myvol"})
   385  		session.WaitWithDefaultTimeout()
   386  		volName := session.OutputToString()
   387  		Expect(session).Should(Exit(0))
   388  
   389  		session = podmanTest.Podman([]string{"inspect", volName})
   390  		session.WaitWithDefaultTimeout()
   391  		Expect(session).Should(Exit(0))
   392  		Expect(session.IsJSONOutputValid()).To(BeTrue())
   393  	})
   394  
   395  	It("podman inspect a volume with --format", func() {
   396  		session := podmanTest.Podman([]string{"volume", "create", "myvol"})
   397  		session.WaitWithDefaultTimeout()
   398  		volName := session.OutputToString()
   399  		Expect(session).Should(Exit(0))
   400  
   401  		session = podmanTest.Podman([]string{"inspect", "--format", "{{.Name}}", volName})
   402  		session.WaitWithDefaultTimeout()
   403  		Expect(session).Should(Exit(0))
   404  		Expect(session.OutputToString()).To(Equal(volName))
   405  	})
   406  	It("podman inspect --type container on a pod should fail", func() {
   407  		podName := "testpod"
   408  		create := podmanTest.Podman([]string{"pod", "create", "--name", podName})
   409  		create.WaitWithDefaultTimeout()
   410  		Expect(create).Should(Exit(0))
   411  
   412  		inspect := podmanTest.Podman([]string{"inspect", "--type", "container", podName})
   413  		inspect.WaitWithDefaultTimeout()
   414  		Expect(inspect).To(ExitWithError())
   415  	})
   416  
   417  	It("podman inspect --type network on a container should fail", func() {
   418  		ctrName := "testctr"
   419  		create := podmanTest.Podman([]string{"create", "--name", ctrName, ALPINE})
   420  		create.WaitWithDefaultTimeout()
   421  		Expect(create).Should(Exit(0))
   422  
   423  		inspect := podmanTest.Podman([]string{"inspect", "--type", "network", ctrName})
   424  		inspect.WaitWithDefaultTimeout()
   425  		Expect(inspect).To(ExitWithError())
   426  	})
   427  
   428  	It("podman inspect --type pod on a container should fail", func() {
   429  		ctrName := "testctr"
   430  		create := podmanTest.Podman([]string{"create", "--name", ctrName, ALPINE})
   431  		create.WaitWithDefaultTimeout()
   432  		Expect(create).Should(Exit(0))
   433  
   434  		inspect := podmanTest.Podman([]string{"inspect", "--type", "pod", ctrName})
   435  		inspect.WaitWithDefaultTimeout()
   436  		Expect(inspect).To(ExitWithError())
   437  	})
   438  
   439  	It("podman inspect --type volume on a container should fail", func() {
   440  		ctrName := "testctr"
   441  		create := podmanTest.Podman([]string{"create", "--name", ctrName, ALPINE})
   442  		create.WaitWithDefaultTimeout()
   443  		Expect(create).Should(Exit(0))
   444  
   445  		inspect := podmanTest.Podman([]string{"inspect", "--type", "volume", ctrName})
   446  		inspect.WaitWithDefaultTimeout()
   447  		Expect(inspect).To(ExitWithError())
   448  	})
   449  
   450  	// Fixes https://github.com/containers/podman/issues/8444
   451  	It("podman inspect --format json .NetworkSettings.Ports", func() {
   452  		ctnrName := "Ctnr_" + RandomString(25)
   453  
   454  		create := podmanTest.Podman([]string{"create", "--name", ctnrName, "-p", "8084:80", ALPINE})
   455  		create.WaitWithDefaultTimeout()
   456  		Expect(create).Should(Exit(0))
   457  
   458  		inspect := podmanTest.Podman([]string{"inspect", `--format="{{json .NetworkSettings.Ports}}"`, ctnrName})
   459  		inspect.WaitWithDefaultTimeout()
   460  		Expect(inspect).Should(Exit(0))
   461  		Expect(inspect.OutputToString()).To(Equal(`"{"80/tcp":[{"HostIp":"","HostPort":"8084"}]}"`))
   462  	})
   463  
   464  	It("Verify container inspect has default network", func() {
   465  		SkipIfRootless("Requires root CNI networking")
   466  		ctrName := "testctr"
   467  		session := podmanTest.Podman([]string{"run", "-d", "--name", ctrName, ALPINE, "top"})
   468  		session.WaitWithDefaultTimeout()
   469  		Expect(session).Should(Exit(0))
   470  
   471  		inspect := podmanTest.InspectContainer(ctrName)
   472  		Expect(len(inspect)).To(Equal(1))
   473  		Expect(len(inspect[0].NetworkSettings.Networks)).To(Equal(1))
   474  	})
   475  
   476  	It("Verify stopped container still has default network in inspect", func() {
   477  		SkipIfRootless("Requires root CNI networking")
   478  		ctrName := "testctr"
   479  		session := podmanTest.Podman([]string{"create", "--name", ctrName, ALPINE, "top"})
   480  		session.WaitWithDefaultTimeout()
   481  		Expect(session).Should(Exit(0))
   482  
   483  		inspect := podmanTest.InspectContainer(ctrName)
   484  		Expect(len(inspect)).To(Equal(1))
   485  		Expect(len(inspect[0].NetworkSettings.Networks)).To(Equal(1))
   486  	})
   487  
   488  	It("Container inspect with unlimited uilimits should be -1", func() {
   489  		ctrName := "testctr"
   490  		session := podmanTest.Podman([]string{"run", "-d", "--ulimit", "core=-1:-1", "--name", ctrName, ALPINE, "top"})
   491  		session.WaitWithDefaultTimeout()
   492  		Expect(session).Should(Exit(0))
   493  
   494  		inspect := podmanTest.Podman([]string{"inspect", ctrName})
   495  		inspect.WaitWithDefaultTimeout()
   496  		Expect(inspect).Should(Exit(0))
   497  
   498  		data := inspect.InspectContainerToJSON()
   499  		ulimits := data[0].HostConfig.Ulimits
   500  		Expect(len(ulimits)).To(BeNumerically(">", 0))
   501  		found := false
   502  		for _, ulimit := range ulimits {
   503  			if ulimit.Name == "RLIMIT_CORE" {
   504  				found = true
   505  				Expect(ulimit.Soft).To(BeNumerically("==", -1))
   506  				Expect(ulimit.Hard).To(BeNumerically("==", -1))
   507  			}
   508  		}
   509  		Expect(found).To(BeTrue())
   510  	})
   511  
   512  	It("Dropped capabilities are sorted", func() {
   513  		ctrName := "testCtr"
   514  		session := podmanTest.Podman([]string{"run", "-d", "--cap-drop", "CAP_AUDIT_WRITE", "--cap-drop", "CAP_MKNOD", "--cap-drop", "CAP_NET_RAW", "--name", ctrName, ALPINE, "top"})
   515  		session.WaitWithDefaultTimeout()
   516  		Expect(session).Should(Exit(0))
   517  
   518  		inspect := podmanTest.Podman([]string{"inspect", ctrName})
   519  		inspect.WaitWithDefaultTimeout()
   520  		Expect(inspect).Should(Exit(0))
   521  
   522  		data := inspect.InspectContainerToJSON()
   523  		Expect(len(data)).To(Equal(1))
   524  		Expect(len(data[0].HostConfig.CapDrop)).To(Equal(3))
   525  		Expect(data[0].HostConfig.CapDrop[0]).To(Equal("CAP_AUDIT_WRITE"))
   526  		Expect(data[0].HostConfig.CapDrop[1]).To(Equal("CAP_MKNOD"))
   527  		Expect(data[0].HostConfig.CapDrop[2]).To(Equal("CAP_NET_RAW"))
   528  	})
   529  
   530  	It("podman inspect container with GO format for PidFile", func() {
   531  		SkipIfRemote("pidfile not handled by remote")
   532  		session, ec, _ := podmanTest.RunLsContainer("test1")
   533  		Expect(ec).To(Equal(0))
   534  
   535  		session = podmanTest.Podman([]string{"inspect", "--format", "{{.PidFile}}", "test1"})
   536  		session.WaitWithDefaultTimeout()
   537  		Expect(session).Should(Exit(0))
   538  	})
   539  })