github.com/containers/podman/v5@v5.1.0-rc1/test/e2e/create_staticmac_test.go (about)

     1  package integration
     2  
     3  import (
     4  	. "github.com/containers/podman/v5/test/utils"
     5  	"github.com/containers/storage/pkg/stringid"
     6  	. "github.com/onsi/ginkgo/v2"
     7  	. "github.com/onsi/gomega"
     8  	. "github.com/onsi/gomega/gexec"
     9  )
    10  
    11  var _ = Describe("Podman run with --mac-address flag", func() {
    12  
    13  	It("Podman run --mac-address", func() {
    14  		result := podmanTest.Podman([]string{"run", "--mac-address", "92:d0:c6:0a:29:34", ALPINE, "ip", "addr"})
    15  		result.WaitWithDefaultTimeout()
    16  		if isRootless() {
    17  			Expect(result).Should(Exit(125))
    18  		} else {
    19  			Expect(result).Should(ExitCleanly())
    20  			Expect(result.OutputToString()).To(ContainSubstring("92:d0:c6:0a:29:34"))
    21  		}
    22  	})
    23  
    24  	It("Podman run --mac-address with custom network", func() {
    25  		net := "n1" + stringid.GenerateRandomID()
    26  		session := podmanTest.Podman([]string{"network", "create", net})
    27  		session.WaitWithDefaultTimeout()
    28  		defer podmanTest.removeNetwork(net)
    29  		Expect(session).Should(ExitCleanly())
    30  
    31  		result := podmanTest.Podman([]string{"run", "--network", net, "--mac-address", "92:d0:c6:00:29:34", ALPINE, "ip", "addr"})
    32  		result.WaitWithDefaultTimeout()
    33  		Expect(result).Should(ExitCleanly())
    34  		Expect(result.OutputToString()).To(ContainSubstring("92:d0:c6:00:29:34"))
    35  	})
    36  })