github.com/dmaizel/tests@v0.0.0-20210728163746-cae6a2d9cee8/integration/docker/logs_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("logs", func() {
    13  	var id string
    14  
    15  	BeforeEach(func() {
    16  		id = randomDockerName()
    17  		_, _, exitCode := dockerRun("-t", "--name", id, Image, "/bin/echo", "hello")
    18  		Expect(exitCode).To(Equal(0))
    19  	})
    20  
    21  	AfterEach(func() {
    22  		Expect(RemoveDockerContainer(id)).To(BeTrue())
    23  		Expect(ExistDockerContainer(id)).NotTo(BeTrue())
    24  	})
    25  
    26  	Describe("logs with docker", func() {
    27  		Context("check logs functionality", func() {
    28  			It("should work", func() {
    29  				stdout, _ := LogsDockerContainer(id)
    30  				Expect(stdout).To(ContainSubstring("hello"))
    31  			})
    32  		})
    33  	})
    34  })