github.com/hanks177/podman/v4@v4.1.3-0.20220613032544-16d90015bc83/test/e2e/system_dial_stdio_test.go (about)

     1  package integration
     2  
     3  import (
     4  	"fmt"
     5  	"os"
     6  
     7  	. "github.com/hanks177/podman/v4/test/utils"
     8  	. "github.com/onsi/ginkgo"
     9  	. "github.com/onsi/gomega"
    10  	. "github.com/onsi/gomega/gexec"
    11  )
    12  
    13  var _ = Describe("podman system dial-stdio", func() {
    14  	var (
    15  		tempdir    string
    16  		err        error
    17  		podmanTest *PodmanTestIntegration
    18  	)
    19  
    20  	BeforeEach(func() {
    21  		tempdir, err = CreateTempDirInTempDir()
    22  		if err != nil {
    23  			os.Exit(1)
    24  		}
    25  		podmanTest = PodmanTestCreate(tempdir)
    26  		podmanTest.Setup()
    27  	})
    28  
    29  	AfterEach(func() {
    30  		podmanTest.Cleanup()
    31  		f := CurrentGinkgoTestDescription()
    32  		timedResult := fmt.Sprintf("Test: %s completed in %f seconds", f.TestText, f.Duration.Seconds())
    33  		_, _ = GinkgoWriter.Write([]byte(timedResult))
    34  	})
    35  
    36  	It("podman system dial-stdio help", func() {
    37  		session := podmanTest.Podman([]string{"system", "dial-stdio", "--help"})
    38  		session.WaitWithDefaultTimeout()
    39  		Expect(session).Should(Exit(0))
    40  		Expect(session.OutputToString()).To(ContainSubstring("Examples: podman system dial-stdio"))
    41  	})
    42  
    43  	It("podman system dial-stdio while service is not running", func() {
    44  		if IsRemote() {
    45  			Skip("this test is only for non-remote")
    46  		}
    47  		session := podmanTest.Podman([]string{"system", "dial-stdio"})
    48  		session.WaitWithDefaultTimeout()
    49  		Expect(session).Should(Exit(125))
    50  		Expect(session.ErrorToString()).To(ContainSubstring("Error: failed to open connection to podman"))
    51  	})
    52  })