mirror of
https://github.com/containers/podman.git
synced 2025-06-24 11:28:24 +08:00
tests: fix NOTIFY_SOCKET test
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
@ -3,6 +3,7 @@ package integration
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
"net"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
@ -287,13 +288,27 @@ var _ = Describe("Podman run", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("podman run notify_socket", func() {
|
It("podman run notify_socket", func() {
|
||||||
sock := "/run/notify"
|
host := GetHostDistributionInfo()
|
||||||
|
if host.Distribution != "rhel" && host.Distribution != "centos" && host.Distribution != "fedora" {
|
||||||
|
Skip("this test requires a working runc")
|
||||||
|
}
|
||||||
|
sock := filepath.Join(podmanTest.TempDir, "notify")
|
||||||
|
addr := net.UnixAddr{
|
||||||
|
Name: sock,
|
||||||
|
Net: "unixgram",
|
||||||
|
}
|
||||||
|
socket, err := net.ListenUnixgram("unixgram", &addr)
|
||||||
|
Expect(err).To(BeNil())
|
||||||
|
defer os.Remove(sock)
|
||||||
|
defer socket.Close()
|
||||||
|
|
||||||
os.Setenv("NOTIFY_SOCKET", sock)
|
os.Setenv("NOTIFY_SOCKET", sock)
|
||||||
|
defer os.Unsetenv("NOTIFY_SOCKET")
|
||||||
|
|
||||||
session := podmanTest.Podman([]string{"run", "--rm", ALPINE, "printenv", "NOTIFY_SOCKET"})
|
session := podmanTest.Podman([]string{"run", "--rm", ALPINE, "printenv", "NOTIFY_SOCKET"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session.ExitCode()).To(Equal(0))
|
Expect(session.ExitCode()).To(Equal(0))
|
||||||
Expect(len(session.OutputToStringArray())).To(BeNumerically(">", 0))
|
Expect(len(session.OutputToStringArray())).To(BeNumerically(">", 0))
|
||||||
os.Unsetenv("NOTIFY_SOCKET")
|
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman run log-opt", func() {
|
It("podman run log-opt", func() {
|
||||||
|
Reference in New Issue
Block a user