github.com/containers/libpod@v1.9.4-0.20220419124438-4284fd425507/test/e2e/create_staticmac_test.go (about)

     1  // +build !remoteclient
     2  
     3  package integration
     4  
     5  import (
     6  	"os"
     7  
     8  	. "github.com/containers/libpod/test/utils"
     9  	. "github.com/onsi/ginkgo"
    10  	. "github.com/onsi/gomega"
    11  )
    12  
    13  var _ = Describe("Podman run with --mac-address flag", func() {
    14  	var (
    15  		tempdir    string
    16  		err        error
    17  		podmanTest *PodmanTestIntegration
    18  	)
    19  
    20  	BeforeEach(func() {
    21  		SkipIfRootless()
    22  		tempdir, err = CreateTempDirInTempDir()
    23  		if err != nil {
    24  			os.Exit(1)
    25  		}
    26  		podmanTest = PodmanTestCreate(tempdir)
    27  		podmanTest.Setup()
    28  		podmanTest.SeedImages()
    29  		// Cleanup the CNI networks used by the tests
    30  		os.RemoveAll("/var/lib/cni/networks/podman")
    31  	})
    32  
    33  	AfterEach(func() {
    34  		podmanTest.Cleanup()
    35  		f := CurrentGinkgoTestDescription()
    36  		processTestResult(f)
    37  
    38  	})
    39  
    40  	It("Podman run --mac-address", func() {
    41  		result := podmanTest.Podman([]string{"run", "--mac-address", "92:d0:c6:0a:29:34", ALPINE, "ip", "addr"})
    42  		result.WaitWithDefaultTimeout()
    43  		Expect(result.ExitCode()).To(Equal(0))
    44  		Expect(result.OutputToString()).To(ContainSubstring("92:d0:c6:0a:29:34"))
    45  	})
    46  })