github.com/dmaizel/tests@v0.0.0-20210728163746-cae6a2d9cee8/integration/docker/diff_test.go (about)

     1  // Copyright (c) 2018 Intel Corporation
     2  //
     3  // SPDX-License-Identifier: Apache-2.0
     4  
     5  package docker
     6  
     7  import (
     8  	. "github.com/onsi/ginkgo"
     9  	. "github.com/onsi/gomega"
    10  )
    11  
    12  var _ = Describe("diff", func() {
    13  	var (
    14  		id   string
    15  		name string = "FirstDirectory"
    16  	)
    17  
    18  	BeforeEach(func() {
    19  		id = randomDockerName()
    20  		// Run this command with -i flag to make sure we keep the
    21  		// container up and running.
    22  		_, _, exitCode := dockerRun("--name", id, "-d", "-i", Image, "sh")
    23  		Expect(exitCode).To(Equal(0))
    24  		_, _, exitCode = dockerExec(id, "mkdir", name)
    25  		Expect(exitCode).To(Equal(0))
    26  	})
    27  
    28  	AfterEach(func() {
    29  		Expect(RemoveDockerContainer(id)).To(BeTrue())
    30  		Expect(ExistDockerContainer(id)).NotTo(BeTrue())
    31  	})
    32  
    33  	Context("inspect changes in a container", func() {
    34  		It("should retrieve the change", func() {
    35  			stdout, _, exitCode := dockerDiff(id)
    36  			Expect(exitCode).To(Equal(0))
    37  			Expect(stdout).To(ContainSubstring(name))
    38  		})
    39  	})
    40  })