mirror of
https://github.com/containers/podman.git
synced 2025-10-18 19:53:58 +08:00
fix a number of godot
issues
Still an unknown number remains but I am running out of patience. Adding dots is not the best use of my time. Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
This commit is contained in:
@ -4,7 +4,7 @@ import "regexp"
|
|||||||
|
|
||||||
var jsonFormatRegex = regexp.MustCompile(`^\s*(json|{{\s*json\s*(\.)?\s*}})\s*$`)
|
var jsonFormatRegex = regexp.MustCompile(`^\s*(json|{{\s*json\s*(\.)?\s*}})\s*$`)
|
||||||
|
|
||||||
// MatchesJSONFormat test CLI --format string to be a JSON request
|
// MatchesJSONFormat test CLI --format string to be a JSON request.
|
||||||
func MatchesJSONFormat(s string) bool {
|
func MatchesJSONFormat(s string) bool {
|
||||||
return jsonFormatRegex.Match([]byte(s))
|
return jsonFormatRegex.Match([]byte(s))
|
||||||
}
|
}
|
||||||
|
@ -244,7 +244,7 @@ func getUDS(cmd *cobra.Command, uri *url.URL, iden string) (string, error) {
|
|||||||
|
|
||||||
// ValidateAndConfigure will take a ssh url and an identity key (rsa and the like) and ensure the information given is valid
|
// ValidateAndConfigure will take a ssh url and an identity key (rsa and the like) and ensure the information given is valid
|
||||||
// iden iden can be blank to mean no identity key
|
// iden iden can be blank to mean no identity key
|
||||||
// once the function validates the information it creates and returns an ssh.ClientConfig
|
// once the function validates the information it creates and returns an ssh.ClientConfig.
|
||||||
func ValidateAndConfigure(uri *url.URL, iden string) (*ssh.ClientConfig, error) {
|
func ValidateAndConfigure(uri *url.URL, iden string) (*ssh.ClientConfig, error) {
|
||||||
var signers []ssh.Signer
|
var signers []ssh.Signer
|
||||||
passwd, passwdSet := uri.User.Password()
|
passwd, passwdSet := uri.User.Password()
|
||||||
|
@ -11,7 +11,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// Skip creating engines since this command will obtain connection information to said engines
|
// Skip creating engines since this command will obtain connection information to said engines.
|
||||||
dfltCmd = &cobra.Command{
|
dfltCmd = &cobra.Command{
|
||||||
Use: "default NAME",
|
Use: "default NAME",
|
||||||
Args: cobra.ExactArgs(1),
|
Args: cobra.ExactArgs(1),
|
||||||
|
@ -10,7 +10,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// Skip creating engines since this command will obtain connection information to said engines
|
// Skip creating engines since this command will obtain connection information to said engines.
|
||||||
rmCmd = &cobra.Command{
|
rmCmd = &cobra.Command{
|
||||||
Use: "remove [options] NAME",
|
Use: "remove [options] NAME",
|
||||||
Aliases: []string{"rm"},
|
Aliases: []string{"rm"},
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
package common
|
package common
|
||||||
|
|
||||||
// IsTrue determines whether the given string equals "true"
|
// IsTrue determines whether the given string equals "true".
|
||||||
func IsTrue(str string) bool {
|
func IsTrue(str string) bool {
|
||||||
return str == "true"
|
return str == "true"
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsFalse determines whether the given string equals "false"
|
// IsFalse determines whether the given string equals "false".
|
||||||
func IsFalse(str string) bool {
|
func IsFalse(str string) bool {
|
||||||
return str == "false"
|
return str == "false"
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsValidBool determines whether the given string equals "true" or "false"
|
// IsValidBool determines whether the given string equals "true" or "false".
|
||||||
func IsValidBool(str string) bool {
|
func IsValidBool(str string) bool {
|
||||||
return IsTrue(str) || IsFalse(str)
|
return IsTrue(str) || IsFalse(str)
|
||||||
}
|
}
|
||||||
|
@ -1,122 +1,122 @@
|
|||||||
package annotations
|
package annotations
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// Annotations carries the received Kubelet annotations
|
// Annotations carries the received Kubelet annotations.
|
||||||
Annotations = "io.kubernetes.cri-o.Annotations"
|
Annotations = "io.kubernetes.cri-o.Annotations"
|
||||||
|
|
||||||
// ContainerID is the container ID annotation
|
// ContainerID is the container ID annotation.
|
||||||
ContainerID = "io.kubernetes.cri-o.ContainerID"
|
ContainerID = "io.kubernetes.cri-o.ContainerID"
|
||||||
|
|
||||||
// ContainerName is the container name annotation
|
// ContainerName is the container name annotation.
|
||||||
ContainerName = "io.kubernetes.cri-o.ContainerName"
|
ContainerName = "io.kubernetes.cri-o.ContainerName"
|
||||||
|
|
||||||
// ContainerType is the container type (sandbox or container) annotation
|
// ContainerType is the container type (sandbox or container) annotation.
|
||||||
ContainerType = "io.kubernetes.cri-o.ContainerType"
|
ContainerType = "io.kubernetes.cri-o.ContainerType"
|
||||||
|
|
||||||
// Created is the container creation time annotation
|
// Created is the container creation time annotation.
|
||||||
Created = "io.kubernetes.cri-o.Created"
|
Created = "io.kubernetes.cri-o.Created"
|
||||||
|
|
||||||
// HostName is the container host name annotation
|
// HostName is the container host name annotation.
|
||||||
HostName = "io.kubernetes.cri-o.HostName"
|
HostName = "io.kubernetes.cri-o.HostName"
|
||||||
|
|
||||||
// CgroupParent is the sandbox cgroup parent
|
// CgroupParent is the sandbox cgroup parent.
|
||||||
CgroupParent = "io.kubernetes.cri-o.CgroupParent"
|
CgroupParent = "io.kubernetes.cri-o.CgroupParent"
|
||||||
|
|
||||||
// IP is the container ipv4 or ipv6 address
|
// IP is the container ipv4 or ipv6 address.
|
||||||
IP = "io.kubernetes.cri-o.IP"
|
IP = "io.kubernetes.cri-o.IP"
|
||||||
|
|
||||||
// NamespaceOptions store the options for namespaces
|
// NamespaceOptions store the options for namespaces.
|
||||||
NamespaceOptions = "io.kubernetes.cri-o.NamespaceOptions"
|
NamespaceOptions = "io.kubernetes.cri-o.NamespaceOptions"
|
||||||
|
|
||||||
// SeccompProfilePath is the node seccomp profile path
|
// SeccompProfilePath is the node seccomp profile path.
|
||||||
SeccompProfilePath = "io.kubernetes.cri-o.SeccompProfilePath"
|
SeccompProfilePath = "io.kubernetes.cri-o.SeccompProfilePath"
|
||||||
|
|
||||||
// Image is the container image ID annotation
|
// Image is the container image ID annotation.
|
||||||
Image = "io.kubernetes.cri-o.Image"
|
Image = "io.kubernetes.cri-o.Image"
|
||||||
|
|
||||||
// ImageName is the container image name annotation
|
// ImageName is the container image name annotation.
|
||||||
ImageName = "io.kubernetes.cri-o.ImageName"
|
ImageName = "io.kubernetes.cri-o.ImageName"
|
||||||
|
|
||||||
// ImageRef is the container image ref annotation
|
// ImageRef is the container image ref annotation.
|
||||||
ImageRef = "io.kubernetes.cri-o.ImageRef"
|
ImageRef = "io.kubernetes.cri-o.ImageRef"
|
||||||
|
|
||||||
// KubeName is the kubernetes name annotation
|
// KubeName is the kubernetes name annotation.
|
||||||
KubeName = "io.kubernetes.cri-o.KubeName"
|
KubeName = "io.kubernetes.cri-o.KubeName"
|
||||||
|
|
||||||
// PortMappings holds the port mappings for the sandbox
|
// PortMappings holds the port mappings for the sandbox.
|
||||||
PortMappings = "io.kubernetes.cri-o.PortMappings"
|
PortMappings = "io.kubernetes.cri-o.PortMappings"
|
||||||
|
|
||||||
// Labels are the kubernetes labels annotation
|
// Labels are the kubernetes labels annotation.
|
||||||
Labels = "io.kubernetes.cri-o.Labels"
|
Labels = "io.kubernetes.cri-o.Labels"
|
||||||
|
|
||||||
// LogPath is the container logging path annotation
|
// LogPath is the container logging path annotation.
|
||||||
LogPath = "io.kubernetes.cri-o.LogPath"
|
LogPath = "io.kubernetes.cri-o.LogPath"
|
||||||
|
|
||||||
// Metadata is the container metadata annotation
|
// Metadata is the container metadata annotation.
|
||||||
Metadata = "io.kubernetes.cri-o.Metadata"
|
Metadata = "io.kubernetes.cri-o.Metadata"
|
||||||
|
|
||||||
// Name is the pod name annotation
|
// Name is the pod name annotation.
|
||||||
Name = "io.kubernetes.cri-o.Name"
|
Name = "io.kubernetes.cri-o.Name"
|
||||||
|
|
||||||
// Namespace is the pod namespace annotation
|
// Namespace is the pod namespace annotation.
|
||||||
Namespace = "io.kubernetes.cri-o.Namespace"
|
Namespace = "io.kubernetes.cri-o.Namespace"
|
||||||
|
|
||||||
// PrivilegedRuntime is the annotation for the privileged runtime path
|
// PrivilegedRuntime is the annotation for the privileged runtime path.
|
||||||
PrivilegedRuntime = "io.kubernetes.cri-o.PrivilegedRuntime"
|
PrivilegedRuntime = "io.kubernetes.cri-o.PrivilegedRuntime"
|
||||||
|
|
||||||
// ResolvPath is the resolver configuration path annotation
|
// ResolvPath is the resolver configuration path annotation.
|
||||||
ResolvPath = "io.kubernetes.cri-o.ResolvPath"
|
ResolvPath = "io.kubernetes.cri-o.ResolvPath"
|
||||||
|
|
||||||
// HostnamePath is the path to /etc/hostname to bind mount annotation
|
// HostnamePath is the path to /etc/hostname to bind mount annotation.
|
||||||
HostnamePath = "io.kubernetes.cri-o.HostnamePath"
|
HostnamePath = "io.kubernetes.cri-o.HostnamePath"
|
||||||
|
|
||||||
// SandboxID is the sandbox ID annotation
|
// SandboxID is the sandbox ID annotation.
|
||||||
SandboxID = "io.kubernetes.cri-o.SandboxID"
|
SandboxID = "io.kubernetes.cri-o.SandboxID"
|
||||||
|
|
||||||
// SandboxName is the sandbox name annotation
|
// SandboxName is the sandbox name annotation.
|
||||||
SandboxName = "io.kubernetes.cri-o.SandboxName"
|
SandboxName = "io.kubernetes.cri-o.SandboxName"
|
||||||
|
|
||||||
// ShmPath is the shared memory path annotation
|
// ShmPath is the shared memory path annotation.
|
||||||
ShmPath = "io.kubernetes.cri-o.ShmPath"
|
ShmPath = "io.kubernetes.cri-o.ShmPath"
|
||||||
|
|
||||||
// MountPoint is the mount point of the container rootfs
|
// MountPoint is the mount point of the container rootfs.
|
||||||
MountPoint = "io.kubernetes.cri-o.MountPoint"
|
MountPoint = "io.kubernetes.cri-o.MountPoint"
|
||||||
|
|
||||||
// RuntimeHandler is the annotation for runtime handler
|
// RuntimeHandler is the annotation for runtime handler.
|
||||||
RuntimeHandler = "io.kubernetes.cri-o.RuntimeHandler"
|
RuntimeHandler = "io.kubernetes.cri-o.RuntimeHandler"
|
||||||
|
|
||||||
// TTY is the terminal path annotation
|
// TTY is the terminal path annotation.
|
||||||
TTY = "io.kubernetes.cri-o.TTY"
|
TTY = "io.kubernetes.cri-o.TTY"
|
||||||
|
|
||||||
// Stdin is the stdin annotation
|
// Stdin is the stdin annotation.
|
||||||
Stdin = "io.kubernetes.cri-o.Stdin"
|
Stdin = "io.kubernetes.cri-o.Stdin"
|
||||||
|
|
||||||
// StdinOnce is the stdin_once annotation
|
// StdinOnce is the stdin_once annotation.
|
||||||
StdinOnce = "io.kubernetes.cri-o.StdinOnce"
|
StdinOnce = "io.kubernetes.cri-o.StdinOnce"
|
||||||
|
|
||||||
// Volumes is the volumes annotation
|
// Volumes is the volumes annotation.
|
||||||
Volumes = "io.kubernetes.cri-o.Volumes"
|
Volumes = "io.kubernetes.cri-o.Volumes"
|
||||||
|
|
||||||
// HostNetwork indicates whether the host network namespace is used or not
|
// HostNetwork indicates whether the host network namespace is used or not.
|
||||||
HostNetwork = "io.kubernetes.cri-o.HostNetwork"
|
HostNetwork = "io.kubernetes.cri-o.HostNetwork"
|
||||||
|
|
||||||
// CNIResult is the JSON string representation of the Result from CNI
|
// CNIResult is the JSON string representation of the Result from CNI.
|
||||||
CNIResult = "io.kubernetes.cri-o.CNIResult"
|
CNIResult = "io.kubernetes.cri-o.CNIResult"
|
||||||
|
|
||||||
// ContainerManager is the annotation key for indicating the creator and
|
// ContainerManager is the annotation key for indicating the creator and
|
||||||
// manager of the container
|
// manager of the container.
|
||||||
ContainerManager = "io.container.manager"
|
ContainerManager = "io.container.manager"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ContainerType values
|
// ContainerType values
|
||||||
const (
|
const (
|
||||||
// ContainerTypeSandbox represents a pod sandbox container
|
// ContainerTypeSandbox represents a pod sandbox container.
|
||||||
ContainerTypeSandbox = "sandbox"
|
ContainerTypeSandbox = "sandbox"
|
||||||
|
|
||||||
// ContainerTypeContainer represents a container running within a pod
|
// ContainerTypeContainer represents a container running within a pod.
|
||||||
ContainerTypeContainer = "container"
|
ContainerTypeContainer = "container"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ContainerManagerLibpod indicates that libpod created and manages the
|
// ContainerManagerLibpod indicates that libpod created and manages the
|
||||||
// container
|
// container.
|
||||||
const ContainerManagerLibpod = "libpod"
|
const ContainerManagerLibpod = "libpod"
|
||||||
|
@ -938,7 +938,7 @@ func (ic *ContainerEngine) ContainerStat(ctx context.Context, nameOrID string, p
|
|||||||
return containers.Stat(ic.ClientCtx, nameOrID, path)
|
return containers.Stat(ic.ClientCtx, nameOrID, path)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Shutdown Libpod engine
|
// Shutdown Libpod engine.
|
||||||
func (ic *ContainerEngine) Shutdown(_ context.Context) {
|
func (ic *ContainerEngine) Shutdown(_ context.Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -949,7 +949,7 @@ func (ic *ContainerEngine) ContainerStats(ctx context.Context, namesOrIds []stri
|
|||||||
return containers.Stats(ic.ClientCtx, namesOrIds, new(containers.StatsOptions).WithStream(options.Stream).WithInterval(options.Interval))
|
return containers.Stats(ic.ClientCtx, namesOrIds, new(containers.StatsOptions).WithStream(options.Stream).WithInterval(options.Interval))
|
||||||
}
|
}
|
||||||
|
|
||||||
// ShouldRestart reports back whether the container will restart
|
// ShouldRestart reports back whether the container will restart.
|
||||||
func (ic *ContainerEngine) ShouldRestart(_ context.Context, id string) (bool, error) {
|
func (ic *ContainerEngine) ShouldRestart(_ context.Context, id string) (bool, error) {
|
||||||
return containers.ShouldRestart(ic.ClientCtx, id, nil)
|
return containers.ShouldRestart(ic.ClientCtx, id, nil)
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ func (ic *ContainerEngine) Events(ctx context.Context, opts entities.EventsOptio
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetLastContainerEvent takes a container name or ID and an event status and returns
|
// GetLastContainerEvent takes a container name or ID and an event status and returns
|
||||||
// the last occurrence of the container event
|
// the last occurrence of the container event.
|
||||||
func (ic *ContainerEngine) GetLastContainerEvent(ctx context.Context, nameOrID string, containerEvent events.Status) (*events.Event, error) {
|
func (ic *ContainerEngine) GetLastContainerEvent(ctx context.Context, nameOrID string, containerEvent events.Status) (*events.Event, error) {
|
||||||
// check to make sure the event.Status is valid
|
// check to make sure the event.Status is valid
|
||||||
if _, err := events.StringToStatus(containerEvent.String()); err != nil {
|
if _, err := events.StringToStatus(containerEvent.String()); err != nil {
|
||||||
|
@ -9,7 +9,7 @@ import (
|
|||||||
v1 "github.com/opencontainers/image-spec/specs-go/v1"
|
v1 "github.com/opencontainers/image-spec/specs-go/v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
// ImageData holds the inspect information of an image
|
// ImageData holds the inspect information of an image.
|
||||||
type ImageData struct {
|
type ImageData struct {
|
||||||
ID string `json:"Id"`
|
ID string `json:"Id"`
|
||||||
Digest digest.Digest `json:"Digest"`
|
Digest digest.Digest `json:"Digest"`
|
||||||
@ -36,13 +36,13 @@ type ImageData struct {
|
|||||||
HealthCheck *manifest.Schema2HealthConfig `json:"Healthcheck,omitempty"`
|
HealthCheck *manifest.Schema2HealthConfig `json:"Healthcheck,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// RootFS holds the root fs information of an image
|
// RootFS holds the root fs information of an image.
|
||||||
type RootFS struct {
|
type RootFS struct {
|
||||||
Type string `json:"Type"`
|
Type string `json:"Type"`
|
||||||
Layers []digest.Digest `json:"Layers"`
|
Layers []digest.Digest `json:"Layers"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ImageResult is used for podman images for collection and output
|
// ImageResult is used for podman images for collection and output.
|
||||||
type ImageResult struct {
|
type ImageResult struct {
|
||||||
Tag string
|
Tag string
|
||||||
Repository string
|
Repository string
|
||||||
|
@ -14,7 +14,7 @@ const (
|
|||||||
etcgroup = "/etc/group"
|
etcgroup = "/etc/group"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Overrides allows you to override defaults in GetUserGroupInfo
|
// Overrides allows you to override defaults in GetUserGroupInfo.
|
||||||
type Overrides struct {
|
type Overrides struct {
|
||||||
DefaultUser *user.ExecUser
|
DefaultUser *user.ExecUser
|
||||||
ContainerEtcPasswdPath string
|
ContainerEtcPasswdPath string
|
||||||
|
@ -36,9 +36,9 @@ type InitOptions struct {
|
|||||||
type QemuMachineStatus = string
|
type QemuMachineStatus = string
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// Running indicates the qemu vm is running
|
// Running indicates the qemu vm is running.
|
||||||
Running QemuMachineStatus = "running"
|
Running QemuMachineStatus = "running"
|
||||||
// Stopped indicates the vm has stopped
|
// Stopped indicates the vm has stopped.
|
||||||
Stopped QemuMachineStatus = "stopped"
|
Stopped QemuMachineStatus = "stopped"
|
||||||
DefaultMachineName string = "podman-machine-default"
|
DefaultMachineName string = "podman-machine-default"
|
||||||
)
|
)
|
||||||
@ -147,7 +147,7 @@ func (rc RemoteConnectionType) MakeSSHURL(host, path, port, userName string) url
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetDataDir returns the filepath where vm images should
|
// GetDataDir returns the filepath where vm images should
|
||||||
// live for podman-machine
|
// live for podman-machine.
|
||||||
func GetDataDir(vmType string) (string, error) {
|
func GetDataDir(vmType string) (string, error) {
|
||||||
data, err := homedir.GetDataHome()
|
data, err := homedir.GetDataHome()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -61,6 +61,6 @@ type Monitor struct {
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
// defaultQMPTimeout is the timeout duration for the
|
// defaultQMPTimeout is the timeout duration for the
|
||||||
// qmp monitor interactions
|
// qmp monitor interactions.
|
||||||
defaultQMPTimeout time.Duration = 2 * time.Second
|
defaultQMPTimeout time.Duration = 2 * time.Second
|
||||||
)
|
)
|
||||||
|
@ -34,7 +34,7 @@ import (
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
qemuProvider = &Provider{}
|
qemuProvider = &Provider{}
|
||||||
// vmtype refers to qemu (vs libvirt, krun, etc)
|
// vmtype refers to qemu (vs libvirt, krun, etc).
|
||||||
vmtype = "qemu"
|
vmtype = "qemu"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ func ParseSignal(rawSignal string) (syscall.Signal, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ParseSignalNameOrNumber translates a string to a valid syscall signal. Input
|
// ParseSignalNameOrNumber translates a string to a valid syscall signal. Input
|
||||||
// can be a name or number representation i.e. "KILL" "9"
|
// can be a name or number representation i.e. "KILL" "9".
|
||||||
func ParseSignalNameOrNumber(rawSignal string) (syscall.Signal, error) {
|
func ParseSignalNameOrNumber(rawSignal string) (syscall.Signal, error) {
|
||||||
basename := strings.TrimPrefix(rawSignal, "-")
|
basename := strings.TrimPrefix(rawSignal, "-")
|
||||||
s, err := ParseSignal(basename)
|
s, err := ParseSignal(basename)
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
package terminal
|
package terminal
|
||||||
|
|
||||||
// SetConsole for non-windows environments is a no-op
|
// SetConsole for non-windows environments is a no-op.
|
||||||
func SetConsole() error {
|
func SetConsole() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ import (
|
|||||||
"github.com/onsi/gomega/types"
|
"github.com/onsi/gomega/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
// HaveActiveService verifies the given service is the active service
|
// HaveActiveService verifies the given service is the active service.
|
||||||
func HaveActiveService(name interface{}) OmegaMatcher {
|
func HaveActiveService(name interface{}) OmegaMatcher {
|
||||||
return WithTransform(
|
return WithTransform(
|
||||||
func(cfg *config.Config) string {
|
func(cfg *config.Config) string {
|
||||||
@ -86,7 +86,7 @@ type URLMatcher struct {
|
|||||||
matchers.EqualMatcher
|
matchers.EqualMatcher
|
||||||
}
|
}
|
||||||
|
|
||||||
// VerifyURL matches when actual is a valid URL and matches expected
|
// VerifyURL matches when actual is a valid URL and matches expected.
|
||||||
func VerifyURL(uri interface{}) OmegaMatcher {
|
func VerifyURL(uri interface{}) OmegaMatcher {
|
||||||
return &URLMatcher{matchers.EqualMatcher{Expected: uri}}
|
return &URLMatcher{matchers.EqualMatcher{Expected: uri}}
|
||||||
}
|
}
|
||||||
@ -129,7 +129,7 @@ func ExitWithError(optionalExitCode ...int) *ExitMatcher {
|
|||||||
return &ExitMatcher{Expected: exitCode}
|
return &ExitMatcher{Expected: exitCode}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Match follows gexec.Matcher interface
|
// Match follows gexec.Matcher interface.
|
||||||
func (matcher *ExitMatcher) Match(actual interface{}) (success bool, err error) {
|
func (matcher *ExitMatcher) Match(actual interface{}) (success bool, err error) {
|
||||||
exiter, ok := actual.(gexec.Exiter)
|
exiter, ok := actual.(gexec.Exiter)
|
||||||
if !ok {
|
if !ok {
|
||||||
|
@ -7,7 +7,7 @@ import (
|
|||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Find a random, open port on the host
|
// Find a random, open port on the host.
|
||||||
func GetRandomPort() (int, error) {
|
func GetRandomPort() (int, error) {
|
||||||
l, err := net.Listen("tcp", ":0")
|
l, err := net.Listen("tcp", ":0")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -21,7 +21,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// ExecCmd executes a command with args and returns its output as a string along
|
// ExecCmd executes a command with args and returns its output as a string along
|
||||||
// with an error, if any
|
// with an error, if any.
|
||||||
func ExecCmd(name string, args ...string) (string, error) {
|
func ExecCmd(name string, args ...string) (string, error) {
|
||||||
cmd := exec.Command(name, args...)
|
cmd := exec.Command(name, args...)
|
||||||
var stdout bytes.Buffer
|
var stdout bytes.Buffer
|
||||||
|
Reference in New Issue
Block a user