mirror of
https://github.com/containers/gvisor-tap-vsock.git
synced 2025-10-05 08:46:58 +08:00

Adds a basic implementation for testing against a vfkit VM. Tests are based on the existing qemu version. It just changes the way the VM gets created/started. It also adds a func to decompress .gz files as the fcos release for apple hypervisor is raw.gz format Signed-off-by: Luca Stocchi <lstocchi@redhat.com>
20 lines
339 B
Go
20 lines
339 B
Go
package e2eutils
|
|
|
|
import (
|
|
"net"
|
|
"strconv"
|
|
)
|
|
|
|
func IsPortAvailable(port int) bool {
|
|
return IsHostPortAvailable("127.0.0.1", port)
|
|
}
|
|
|
|
func IsHostPortAvailable(host string, port int) bool {
|
|
listener, err := net.Listen("tcp", net.JoinHostPort(host, strconv.Itoa(port)))
|
|
if err != nil {
|
|
return false
|
|
}
|
|
listener.Close()
|
|
return true
|
|
}
|