mirror of
https://github.com/containers/podman.git
synced 2025-10-16 02:32:55 +08:00
lint: reenable revive unused-parameter check
Signed-off-by: Matt Souza <medsouz99@gmail.com>
This commit is contained in:
@ -264,7 +264,7 @@ func (s *BoltState) Refresh() error {
|
||||
// Then save the modified state
|
||||
// Also clear all network namespaces
|
||||
toRemoveIDs := []string{}
|
||||
err = idBucket.ForEach(func(id, name []byte) error {
|
||||
err = idBucket.ForEach(func(id, _ []byte) error {
|
||||
ctrBkt := ctrsBucket.Bucket(id)
|
||||
if ctrBkt == nil {
|
||||
// It's a pod
|
||||
@ -345,7 +345,7 @@ func (s *BoltState) Refresh() error {
|
||||
// Can't delete in a ForEach, so build a list of
|
||||
// what to remove then remove.
|
||||
toRemove := []string{}
|
||||
err = ctrExecBkt.ForEach(func(id, unused []byte) error {
|
||||
err = ctrExecBkt.ForEach(func(id, _ []byte) error {
|
||||
toRemove = append(toRemove, string(id))
|
||||
return nil
|
||||
})
|
||||
@ -384,7 +384,7 @@ func (s *BoltState) Refresh() error {
|
||||
}
|
||||
|
||||
// Now refresh volumes
|
||||
err = allVolsBucket.ForEach(func(id, name []byte) error {
|
||||
err = allVolsBucket.ForEach(func(id, _ []byte) error {
|
||||
dbVol := volBucket.Bucket(id)
|
||||
if dbVol == nil {
|
||||
return fmt.Errorf("inconsistency in state - volume %s is in all volumes bucket but volume not found: %w", string(id), define.ErrInternal)
|
||||
@ -425,7 +425,7 @@ func (s *BoltState) Refresh() error {
|
||||
// So we have to make a list of what to operate on, then do the
|
||||
// work.
|
||||
toRemoveExec := []string{}
|
||||
err = execBucket.ForEach(func(id, unused []byte) error {
|
||||
err = execBucket.ForEach(func(id, _ []byte) error {
|
||||
toRemoveExec = append(toRemoveExec, string(id))
|
||||
return nil
|
||||
})
|
||||
@ -941,7 +941,7 @@ func (s *BoltState) ContainerInUse(ctr *Container) ([]string, error) {
|
||||
}
|
||||
|
||||
// Iterate through and add dependencies
|
||||
err = dependsBkt.ForEach(func(id, value []byte) error {
|
||||
err = dependsBkt.ForEach(func(id, _ []byte) error {
|
||||
depCtrs = append(depCtrs, string(id))
|
||||
|
||||
return nil
|
||||
@ -985,7 +985,7 @@ func (s *BoltState) AllContainers(loadState bool) ([]*Container, error) {
|
||||
return err
|
||||
}
|
||||
|
||||
return allCtrsBucket.ForEach(func(id, name []byte) error {
|
||||
return allCtrsBucket.ForEach(func(id, _ []byte) error {
|
||||
// If performance becomes an issue, this check can be
|
||||
// removed. But the error messages that come back will
|
||||
// be much less helpful.
|
||||
@ -1106,7 +1106,7 @@ func (s *BoltState) GetNetworks(ctr *Container) (map[string]types.PerNetworkOpti
|
||||
networkList = []string{ctr.runtime.config.Network.DefaultNetwork}
|
||||
}
|
||||
} else {
|
||||
err = ctrNetworkBkt.ForEach(func(network, v []byte) error {
|
||||
err = ctrNetworkBkt.ForEach(func(network, _ []byte) error {
|
||||
networkList = append(networkList, string(network))
|
||||
return nil
|
||||
})
|
||||
@ -1140,7 +1140,7 @@ func (s *BoltState) GetNetworks(ctr *Container) (map[string]types.PerNetworkOpti
|
||||
}
|
||||
|
||||
// let's ignore the error here there is nothing we can do
|
||||
_ = netAliasesBkt.ForEach(func(alias, v []byte) error {
|
||||
_ = netAliasesBkt.ForEach(func(alias, _ []byte) error {
|
||||
aliases = append(aliases, string(alias))
|
||||
return nil
|
||||
})
|
||||
@ -1755,7 +1755,7 @@ func (s *BoltState) GetContainerExecSessions(ctr *Container) ([]string, error) {
|
||||
return nil
|
||||
}
|
||||
|
||||
return ctrExecSessions.ForEach(func(id, unused []byte) error {
|
||||
return ctrExecSessions.ForEach(func(id, _ []byte) error {
|
||||
sessions = append(sessions, string(id))
|
||||
return nil
|
||||
})
|
||||
@ -1808,7 +1808,7 @@ func (s *BoltState) RemoveContainerExecSessions(ctr *Container) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
err = ctrExecSessions.ForEach(func(id, unused []byte) error {
|
||||
err = ctrExecSessions.ForEach(func(id, _ []byte) error {
|
||||
sessions = append(sessions, string(id))
|
||||
return nil
|
||||
})
|
||||
@ -2186,7 +2186,7 @@ func (s *BoltState) LookupPod(idOrName string) (*Pod, error) {
|
||||
// They did not give us a full pod name or ID.
|
||||
// Search for partial ID matches.
|
||||
exists := false
|
||||
err = podBkt.ForEach(func(checkID, checkName []byte) error {
|
||||
err = podBkt.ForEach(func(checkID, _ []byte) error {
|
||||
if strings.HasPrefix(string(checkID), idOrName) {
|
||||
if exists {
|
||||
return fmt.Errorf("more than one result for ID or name %s: %w", idOrName, define.ErrPodExists)
|
||||
@ -2355,7 +2355,7 @@ func (s *BoltState) PodContainersByID(pod *Pod) ([]string, error) {
|
||||
}
|
||||
|
||||
// Iterate through all containers in the pod
|
||||
err = podCtrs.ForEach(func(id, val []byte) error {
|
||||
err = podCtrs.ForEach(func(id, _ []byte) error {
|
||||
ctrs = append(ctrs, string(id))
|
||||
|
||||
return nil
|
||||
@ -2418,7 +2418,7 @@ func (s *BoltState) PodContainers(pod *Pod) ([]*Container, error) {
|
||||
}
|
||||
|
||||
// Iterate through all containers in the pod
|
||||
err = podCtrs.ForEach(func(id, val []byte) error {
|
||||
err = podCtrs.ForEach(func(id, _ []byte) error {
|
||||
newCtr := new(Container)
|
||||
newCtr.config = new(ContainerConfig)
|
||||
newCtr.state = new(ContainerState)
|
||||
@ -2581,7 +2581,7 @@ func (s *BoltState) RemoveVolume(volume *Volume) error {
|
||||
volCtrsBkt := volDB.Bucket(volDependenciesBkt)
|
||||
if volCtrsBkt != nil {
|
||||
var deps []string
|
||||
err = volCtrsBkt.ForEach(func(id, value []byte) error {
|
||||
err = volCtrsBkt.ForEach(func(id, _ []byte) error {
|
||||
// Alright, this is ugly.
|
||||
// But we need it to work around the change in
|
||||
// volume dependency handling, to make sure that
|
||||
@ -2745,7 +2745,7 @@ func (s *BoltState) AllVolumes() ([]*Volume, error) {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = allVolsBucket.ForEach(func(id, name []byte) error {
|
||||
err = allVolsBucket.ForEach(func(id, _ []byte) error {
|
||||
volExists := volBucket.Bucket(id)
|
||||
// This check can be removed if performance becomes an
|
||||
// issue, but much less helpful errors will be produced
|
||||
@ -2854,7 +2854,7 @@ func (s *BoltState) LookupVolume(name string) (*Volume, error) {
|
||||
|
||||
// No exact match. Search all names.
|
||||
foundMatch := false
|
||||
err = allVolsBkt.ForEach(func(checkName, checkName2 []byte) error {
|
||||
err = allVolsBkt.ForEach(func(checkName, _ []byte) error {
|
||||
if strings.HasPrefix(string(checkName), name) {
|
||||
if foundMatch {
|
||||
return fmt.Errorf("more than one result for volume name %q: %w", name, define.ErrVolumeExists)
|
||||
@ -2964,7 +2964,7 @@ func (s *BoltState) VolumeInUse(volume *Volume) ([]string, error) {
|
||||
}
|
||||
|
||||
// Iterate through and add dependencies
|
||||
err = dependsBkt.ForEach(func(id, value []byte) error {
|
||||
err = dependsBkt.ForEach(func(id, _ []byte) error {
|
||||
// Look up all dependencies and see that they
|
||||
// still exist before appending.
|
||||
ctrExists := ctrBucket.Bucket(id)
|
||||
@ -3252,7 +3252,7 @@ func (s *BoltState) RemovePodContainers(pod *Pod) error {
|
||||
// This should never be nil, but if it is, we're
|
||||
// removing it anyways, so continue if it is
|
||||
if ctrDeps != nil {
|
||||
err = ctrDeps.ForEach(func(depID, name []byte) error {
|
||||
err = ctrDeps.ForEach(func(depID, _ []byte) error {
|
||||
exists := podCtrsBkt.Get(depID)
|
||||
if exists == nil {
|
||||
return fmt.Errorf("container %s has dependency %s outside of pod %s: %w", string(id), string(depID), pod.ID(), define.ErrCtrExists)
|
||||
@ -3485,7 +3485,7 @@ func (s *BoltState) AllPods() ([]*Pod, error) {
|
||||
return err
|
||||
}
|
||||
|
||||
err = allPodsBucket.ForEach(func(id, name []byte) error {
|
||||
err = allPodsBucket.ForEach(func(id, _ []byte) error {
|
||||
podExists := podBucket.Bucket(id)
|
||||
// This check can be removed if performance becomes an
|
||||
// issue, but much less helpful errors will be produced
|
||||
|
@ -900,7 +900,7 @@ func (s *BoltState) removeContainer(ctr *Container, pod *Pod, tx *bolt.Tx) error
|
||||
ctrExecSessionsBkt := ctrExists.Bucket(execBkt)
|
||||
if ctrExecSessionsBkt != nil {
|
||||
sessions := []string{}
|
||||
err = ctrExecSessionsBkt.ForEach(func(id, value []byte) error {
|
||||
err = ctrExecSessionsBkt.ForEach(func(id, _ []byte) error {
|
||||
sessions = append(sessions, string(id))
|
||||
|
||||
return nil
|
||||
@ -919,7 +919,7 @@ func (s *BoltState) removeContainer(ctr *Container, pod *Pod, tx *bolt.Tx) error
|
||||
return fmt.Errorf("container %s does not have a dependencies bucket: %w", ctr.ID(), define.ErrInternal)
|
||||
}
|
||||
deps := []string{}
|
||||
err = ctrDepsBkt.ForEach(func(id, value []byte) error {
|
||||
err = ctrDepsBkt.ForEach(func(id, _ []byte) error {
|
||||
deps = append(deps, string(id))
|
||||
|
||||
return nil
|
||||
@ -1034,7 +1034,7 @@ func (s *BoltState) lookupContainerID(idOrName string, ctrBucket, namesBucket *b
|
||||
// We were not given a full container ID or name.
|
||||
// Search for partial ID matches.
|
||||
exists := false
|
||||
err := ctrBucket.ForEach(func(checkID, checkName []byte) error {
|
||||
err := ctrBucket.ForEach(func(checkID, _ []byte) error {
|
||||
if strings.HasPrefix(string(checkID), idOrName) {
|
||||
if exists {
|
||||
return fmt.Errorf("more than one result for container ID %s: %w", idOrName, define.ErrCtrExists)
|
||||
|
@ -948,7 +948,7 @@ func (c *Container) ReloadNetwork() error {
|
||||
}
|
||||
|
||||
// Refresh is DEPRECATED and REMOVED.
|
||||
func (c *Container) Refresh(ctx context.Context) error {
|
||||
func (c *Container) Refresh(_ context.Context) error {
|
||||
// This has been deprecated for a long while, and is in the process of
|
||||
// being removed.
|
||||
return define.ErrNotImplemented
|
||||
@ -1080,7 +1080,7 @@ func (c *Container) Restore(ctx context.Context, options ContainerCheckpointOpti
|
||||
}
|
||||
|
||||
// Indicate whether or not the container should restart
|
||||
func (c *Container) ShouldRestart(ctx context.Context) bool {
|
||||
func (c *Container) ShouldRestart(_ context.Context) bool {
|
||||
logrus.Debugf("Checking if container %s should restart", c.ID())
|
||||
if !c.batched {
|
||||
c.lock.Lock()
|
||||
@ -1110,7 +1110,7 @@ func (c *Container) CopyFromArchive(_ context.Context, containerPath string, cho
|
||||
|
||||
// CopyToArchive copies the contents from the specified path *inside* the
|
||||
// container to the tarStream.
|
||||
func (c *Container) CopyToArchive(ctx context.Context, containerPath string, tarStream io.Writer) (func() error, error) {
|
||||
func (c *Container) CopyToArchive(_ context.Context, containerPath string, tarStream io.Writer) (func() error, error) {
|
||||
if !c.batched {
|
||||
c.lock.Lock()
|
||||
defer c.lock.Unlock()
|
||||
@ -1124,7 +1124,7 @@ func (c *Container) CopyToArchive(ctx context.Context, containerPath string, tar
|
||||
}
|
||||
|
||||
// Stat the specified path *inside* the container and return a file info.
|
||||
func (c *Container) Stat(ctx context.Context, containerPath string) (*define.FileInfo, error) {
|
||||
func (c *Container) Stat(_ context.Context, containerPath string) (*define.FileInfo, error) {
|
||||
if !c.batched {
|
||||
c.lock.Lock()
|
||||
defer c.lock.Unlock()
|
||||
|
@ -478,7 +478,7 @@ func (c *Container) execStartAndAttach(sessionID string, streams *define.AttachS
|
||||
// ExecHTTPStartAndAttach starts and performs an HTTP attach to an exec session.
|
||||
// newSize resizes the tty to this size before the process is started, must be nil if the exec session has no tty
|
||||
func (c *Container) ExecHTTPStartAndAttach(sessionID string, r *http.Request, w http.ResponseWriter,
|
||||
streams *HTTPAttachStreams, detachKeys *string, cancel <-chan bool, hijackDone chan<- bool, newSize *resize.TerminalSize) error {
|
||||
streams *HTTPAttachStreams, _ *string, cancel <-chan bool, hijackDone chan<- bool, newSize *resize.TerminalSize) error {
|
||||
// TODO: How do we combine streams with the default streams set in the exec session?
|
||||
|
||||
// Ensure that we don't leak a goroutine here
|
||||
|
@ -394,7 +394,7 @@ func stopContainerGraph(ctx context.Context, graph *ContainerGraph, pod *Pod, ti
|
||||
nodeDetails.ctrErrors = syncmap.New[string, error]()
|
||||
nodeDetails.ctrsVisited = syncmap.New[string, bool]()
|
||||
|
||||
traversalFunc := func(ctr *Container, pod *Pod) error {
|
||||
traversalFunc := func(ctr *Container, _ *Pod) error {
|
||||
ctr.lock.Lock()
|
||||
defer ctr.lock.Unlock()
|
||||
|
||||
|
@ -25,11 +25,11 @@ var (
|
||||
bindOptions = []string{}
|
||||
)
|
||||
|
||||
func (c *Container) mountSHM(shmOptions string) error {
|
||||
func (c *Container) mountSHM(_ string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Container) unmountSHM(path string) error {
|
||||
func (c *Container) unmountSHM(_ string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -190,7 +190,7 @@ func (c *Container) addNetworkContainer(g *generate.Generator, ctr string) error
|
||||
return nil
|
||||
}
|
||||
|
||||
func isRootlessCgroupSet(cgroup string) bool {
|
||||
func isRootlessCgroupSet(_ string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
@ -225,7 +225,7 @@ func (c *Container) addNetworkNamespace(g *generate.Generator) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Container) addSystemdMounts(g *generate.Generator) error {
|
||||
func (c *Container) addSystemdMounts(_ *generate.Generator) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -280,17 +280,17 @@ func (c *Container) addSharedNamespaces(g *generate.Generator) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Container) addRootPropagation(g *generate.Generator, mounts []spec.Mount) error {
|
||||
func (c *Container) addRootPropagation(_ *generate.Generator, _ []spec.Mount) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Container) setProcessLabel(g *generate.Generator) {
|
||||
func (c *Container) setProcessLabel(_ *generate.Generator) {
|
||||
}
|
||||
|
||||
func (c *Container) setMountLabel(g *generate.Generator) {
|
||||
func (c *Container) setMountLabel(_ *generate.Generator) {
|
||||
}
|
||||
|
||||
func (c *Container) setCgroupsPath(g *generate.Generator) error {
|
||||
func (c *Container) setCgroupsPath(_ *generate.Generator) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -378,7 +378,7 @@ func (c *Container) safeMountSubPath(mountPoint, subpath string) (s *safeMountIn
|
||||
return &safeMountInfo{mountPoint: filepath.Join(mountPoint, subpath)}, nil
|
||||
}
|
||||
|
||||
func (c *Container) makePlatformMtabLink(etcInTheContainerFd, rootUID, rootGID int) error {
|
||||
func (c *Container) makePlatformMtabLink(_, _, _ int) error {
|
||||
// /etc/mtab does not exist on FreeBSD
|
||||
return nil
|
||||
}
|
||||
@ -403,7 +403,7 @@ func (c *Container) getPlatformRunPath() (string, error) {
|
||||
return runPath, nil
|
||||
}
|
||||
|
||||
func (c *Container) addMaskedPaths(g *generate.Generator) {
|
||||
func (c *Container) addMaskedPaths(_ *generate.Generator) {
|
||||
// There are currently no FreeBSD-specific masked paths
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,6 @@ package events
|
||||
import "errors"
|
||||
|
||||
// NewEventer creates an eventer based on the eventer type
|
||||
func NewEventer(options EventerOptions) (Eventer, error) {
|
||||
func NewEventer(_ EventerOptions) (Eventer, error) {
|
||||
return nil, errors.New("this function is not available for your platform")
|
||||
}
|
||||
|
@ -3,6 +3,6 @@
|
||||
package events
|
||||
|
||||
// newJournalDEventer always returns an error if libsystemd not found
|
||||
func newJournalDEventer(options EventerOptions) (Eventer, error) {
|
||||
func newJournalDEventer(_ EventerOptions) (Eventer, error) {
|
||||
return nil, ErrNoJournaldLogging
|
||||
}
|
||||
|
@ -10,12 +10,12 @@ import (
|
||||
type EventToNull struct{}
|
||||
|
||||
// Write eats the event and always returns nil
|
||||
func (e EventToNull) Write(ee Event) error {
|
||||
func (e EventToNull) Write(_ Event) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Read does nothing and returns an error.
|
||||
func (e EventToNull) Read(ctx context.Context, options ReadOptions) error {
|
||||
func (e EventToNull) Read(_ context.Context, _ ReadOptions) error {
|
||||
return errors.New("cannot read events with the \"none\" backend")
|
||||
}
|
||||
|
||||
|
@ -7,17 +7,17 @@ import (
|
||||
)
|
||||
|
||||
// createTimer systemd timers for healthchecks of a container
|
||||
func (c *Container) createTimer(interval string, isStartup bool) error {
|
||||
func (c *Container) createTimer(_ string, _ bool) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// startTimer starts a systemd timer for the healthchecks
|
||||
func (c *Container) startTimer(isStartup bool) error {
|
||||
func (c *Container) startTimer(_ bool) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// removeTransientFiles removes the systemd timer and unit files
|
||||
// for the container
|
||||
func (c *Container) removeTransientFiles(ctx context.Context, isStartup bool, unitName string) error {
|
||||
func (c *Container) removeTransientFiles(_ context.Context, _ bool, _ string) error {
|
||||
return nil
|
||||
}
|
||||
|
@ -7,17 +7,17 @@ import (
|
||||
)
|
||||
|
||||
// createTimer systemd timers for healthchecks of a container
|
||||
func (c *Container) createTimer(interval string, isStartup bool) error {
|
||||
func (c *Container) createTimer(_ string, _ bool) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// startTimer starts a systemd timer for the healthchecks
|
||||
func (c *Container) startTimer(isStartup bool) error {
|
||||
func (c *Container) startTimer(_ bool) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// removeTransientFiles removes the systemd timer and unit files
|
||||
// for the container
|
||||
func (c *Container) removeTransientFiles(ctx context.Context, isStartup bool, unitName string) error {
|
||||
func (c *Container) removeTransientFiles(_ context.Context, _ bool, _ string) error {
|
||||
return nil
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ import (
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
func (r *Runtime) setPlatformHostInfo(info *define.HostInfo) error {
|
||||
func (r *Runtime) setPlatformHostInfo(_ *define.HostInfo) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,7 @@ func (p *Pod) getInfraContainer() (*Container, error) {
|
||||
return p.runtime.GetContainer(infraID)
|
||||
}
|
||||
|
||||
func GenerateForKubeDaemonSet(ctx context.Context, pod *YAMLPod, options entities.GenerateKubeOptions) (*YAMLDaemonSet, error) {
|
||||
func GenerateForKubeDaemonSet(_ context.Context, pod *YAMLPod, options entities.GenerateKubeOptions) (*YAMLDaemonSet, error) {
|
||||
// Restart policy for DaemonSets can only be set to Always
|
||||
if pod.Spec.RestartPolicy != "" && pod.Spec.RestartPolicy != v1.RestartPolicyAlways {
|
||||
return nil, fmt.Errorf("k8s DaemonSets can only have restartPolicy set to Always")
|
||||
@ -177,7 +177,7 @@ func GenerateForKubeDaemonSet(ctx context.Context, pod *YAMLPod, options entitie
|
||||
|
||||
// GenerateForKubeDeployment returns a YAMLDeployment from a YAMLPod that is then used to create a kubernetes Deployment
|
||||
// kind YAML.
|
||||
func GenerateForKubeDeployment(ctx context.Context, pod *YAMLPod, options entities.GenerateKubeOptions) (*YAMLDeployment, error) {
|
||||
func GenerateForKubeDeployment(_ context.Context, pod *YAMLPod, options entities.GenerateKubeOptions) (*YAMLDeployment, error) {
|
||||
// Restart policy for Deployments can only be set to Always
|
||||
if options.Type == define.K8sKindDeployment && (pod.Spec.RestartPolicy != "" && pod.Spec.RestartPolicy != v1.RestartPolicyAlways) {
|
||||
return nil, fmt.Errorf("k8s Deployments can only have restartPolicy set to Always")
|
||||
@ -236,7 +236,7 @@ func GenerateForKubeDeployment(ctx context.Context, pod *YAMLPod, options entiti
|
||||
|
||||
// GenerateForKubeJob returns a YAMLDeployment from a YAMLPod that is then used to create a kubernetes Job
|
||||
// kind YAML.
|
||||
func GenerateForKubeJob(ctx context.Context, pod *YAMLPod, options entities.GenerateKubeOptions) (*YAMLJob, error) {
|
||||
func GenerateForKubeJob(_ context.Context, pod *YAMLPod, options entities.GenerateKubeOptions) (*YAMLJob, error) {
|
||||
// Restart policy for Job cannot be set to Always
|
||||
if options.Type == define.K8sKindJob && pod.Spec.RestartPolicy == v1.RestartPolicyAlways {
|
||||
return nil, fmt.Errorf("k8s Jobs can not have restartPolicy set to Always; only Never and OnFailure policies allowed")
|
||||
|
@ -9,12 +9,12 @@ import "fmt"
|
||||
type SHMLockManager struct{}
|
||||
|
||||
// NewSHMLockManager is not supported on this platform
|
||||
func NewSHMLockManager(path string, numLocks uint32) (Manager, error) {
|
||||
func NewSHMLockManager(_ string, _ uint32) (Manager, error) {
|
||||
return nil, fmt.Errorf("not supported")
|
||||
}
|
||||
|
||||
// OpenSHMLockManager is not supported on this platform
|
||||
func OpenSHMLockManager(path string, numLocks uint32) (Manager, error) {
|
||||
func OpenSHMLockManager(_ string, _ uint32) (Manager, error) {
|
||||
return nil, fmt.Errorf("not supported")
|
||||
}
|
||||
|
||||
@ -24,7 +24,7 @@ func (m *SHMLockManager) AllocateLock() (Locker, error) {
|
||||
}
|
||||
|
||||
// RetrieveLock is not supported on this platform
|
||||
func (m *SHMLockManager) RetrieveLock(id string) (Locker, error) {
|
||||
func (m *SHMLockManager) RetrieveLock(_ string) (Locker, error) {
|
||||
return nil, fmt.Errorf("not supported")
|
||||
}
|
||||
|
||||
|
@ -357,7 +357,7 @@ func resultToBasicNetworkConfig(result types.StatusBlock) define.InspectBasicNet
|
||||
}
|
||||
|
||||
// NetworkDisconnect removes a container from the network
|
||||
func (c *Container) NetworkDisconnect(nameOrID, netName string, force bool) error {
|
||||
func (c *Container) NetworkDisconnect(nameOrID, netName string, _ bool) error {
|
||||
// only the bridge mode supports cni networks
|
||||
if err := isBridgeNetMode(c.config.NetMode); err != nil {
|
||||
return err
|
||||
|
@ -44,7 +44,7 @@ type NetstatAddress struct {
|
||||
Collisions uint64 `json:"collisions"`
|
||||
}
|
||||
|
||||
func getSlirp4netnsIP(subnet *net.IPNet) (*net.IP, error) {
|
||||
func getSlirp4netnsIP(_ *net.IPNet) (*net.IP, error) {
|
||||
return nil, errors.New("not implemented GetSlirp4netnsIP")
|
||||
}
|
||||
|
||||
@ -221,7 +221,7 @@ func (c *Container) joinedNetworkNSPath() (string, bool) {
|
||||
return c.state.NetNS, false
|
||||
}
|
||||
|
||||
func (c *Container) inspectJoinedNetworkNS(networkns string) (q types.StatusBlock, retErr error) {
|
||||
func (c *Container) inspectJoinedNetworkNS(_ string) (q types.StatusBlock, retErr error) {
|
||||
// TODO: extract interface information from the vnet jail
|
||||
return types.StatusBlock{}, nil
|
||||
}
|
||||
|
@ -7,6 +7,6 @@ import (
|
||||
spec "github.com/opencontainers/runtime-spec/specs-go"
|
||||
)
|
||||
|
||||
func (c *Container) setProcessCapabilitiesExec(options *ExecOptions, user string, execUser *user.ExecUser, pspec *spec.Process) error {
|
||||
func (c *Container) setProcessCapabilitiesExec(_ *ExecOptions, _ string, _ *user.ExecUser, _ *spec.Process) error {
|
||||
return nil
|
||||
}
|
||||
|
@ -8,19 +8,19 @@ import (
|
||||
"os/exec"
|
||||
)
|
||||
|
||||
func (r *ConmonOCIRuntime) createRootlessContainer(ctr *Container, restoreOptions *ContainerCheckpointOptions, hideFiles bool) (int64, error) {
|
||||
func (r *ConmonOCIRuntime) createRootlessContainer(_ *Container, _ *ContainerCheckpointOptions, _ bool) (int64, error) {
|
||||
return -1, errors.New("unsupported (*ConmonOCIRuntime) createRootlessContainer")
|
||||
}
|
||||
|
||||
// Run the closure with the container's socket label set
|
||||
func (r *ConmonOCIRuntime) withContainerSocketLabel(ctr *Container, closure func() error) error {
|
||||
func (r *ConmonOCIRuntime) withContainerSocketLabel(_ *Container, closure func() error) error {
|
||||
// No label support yet
|
||||
return closure()
|
||||
}
|
||||
|
||||
// moveConmonToCgroupAndSignal gets a container's cgroupParent and moves the conmon process to that cgroup
|
||||
// it then signals for conmon to start by sending nonce data down the start fd
|
||||
func (r *ConmonOCIRuntime) moveConmonToCgroupAndSignal(ctr *Container, cmd *exec.Cmd, startFd *os.File) error {
|
||||
func (r *ConmonOCIRuntime) moveConmonToCgroupAndSignal(_ *Container, _ *exec.Cmd, startFd *os.File) error {
|
||||
// No equivalent to cgroup on FreeBSD, just signal conmon to start
|
||||
if err := writeConmonPipeData(startFd); err != nil {
|
||||
return err
|
||||
|
@ -72,17 +72,17 @@ func (r *MissingRuntime) Path() string {
|
||||
}
|
||||
|
||||
// CreateContainer is not available as the runtime is missing
|
||||
func (r *MissingRuntime) CreateContainer(ctr *Container, restoreOptions *ContainerCheckpointOptions) (int64, error) {
|
||||
func (r *MissingRuntime) CreateContainer(_ *Container, _ *ContainerCheckpointOptions) (int64, error) {
|
||||
return 0, r.printError()
|
||||
}
|
||||
|
||||
// StartContainer is not available as the runtime is missing
|
||||
func (r *MissingRuntime) StartContainer(ctr *Container) error {
|
||||
func (r *MissingRuntime) StartContainer(_ *Container) error {
|
||||
return r.printError()
|
||||
}
|
||||
|
||||
// UpdateContainer is not available as the runtime is missing
|
||||
func (r *MissingRuntime) UpdateContainer(ctr *Container, resources *spec.LinuxResources) error {
|
||||
func (r *MissingRuntime) UpdateContainer(_ *Container, _ *spec.LinuxResources) error {
|
||||
return r.printError()
|
||||
}
|
||||
|
||||
@ -90,63 +90,63 @@ func (r *MissingRuntime) UpdateContainer(ctr *Container, resources *spec.LinuxRe
|
||||
// TODO: We could attempt to unix.Kill() the PID as recorded in the state if we
|
||||
// really want to smooth things out? Won't be perfect, but if the container has
|
||||
// a PID namespace it could be enough?
|
||||
func (r *MissingRuntime) KillContainer(ctr *Container, signal uint, all bool) error {
|
||||
func (r *MissingRuntime) KillContainer(_ *Container, _ uint, _ bool) error {
|
||||
return r.printError()
|
||||
}
|
||||
|
||||
// StopContainer is not available as the runtime is missing
|
||||
func (r *MissingRuntime) StopContainer(ctr *Container, timeout uint, all bool) error {
|
||||
func (r *MissingRuntime) StopContainer(_ *Container, _ uint, _ bool) error {
|
||||
return r.printError()
|
||||
}
|
||||
|
||||
// DeleteContainer is not available as the runtime is missing
|
||||
func (r *MissingRuntime) DeleteContainer(ctr *Container) error {
|
||||
func (r *MissingRuntime) DeleteContainer(_ *Container) error {
|
||||
return r.printError()
|
||||
}
|
||||
|
||||
// PauseContainer is not available as the runtime is missing
|
||||
func (r *MissingRuntime) PauseContainer(ctr *Container) error {
|
||||
func (r *MissingRuntime) PauseContainer(_ *Container) error {
|
||||
return r.printError()
|
||||
}
|
||||
|
||||
// UnpauseContainer is not available as the runtime is missing
|
||||
func (r *MissingRuntime) UnpauseContainer(ctr *Container) error {
|
||||
func (r *MissingRuntime) UnpauseContainer(_ *Container) error {
|
||||
return r.printError()
|
||||
}
|
||||
|
||||
// Attach is not available as the runtime is missing
|
||||
func (r *MissingRuntime) Attach(ctr *Container, params *AttachOptions) error {
|
||||
func (r *MissingRuntime) Attach(_ *Container, _ *AttachOptions) error {
|
||||
return r.printError()
|
||||
}
|
||||
|
||||
// HTTPAttach is not available as the runtime is missing
|
||||
func (r *MissingRuntime) HTTPAttach(ctr *Container, req *http.Request, w http.ResponseWriter, streams *HTTPAttachStreams, detachKeys *string, cancel <-chan bool, hijackDone chan<- bool, streamAttach, streamLogs bool) error {
|
||||
func (r *MissingRuntime) HTTPAttach(_ *Container, _ *http.Request, _ http.ResponseWriter, _ *HTTPAttachStreams, _ *string, _ <-chan bool, _ chan<- bool, _, _ bool) error {
|
||||
return r.printError()
|
||||
}
|
||||
|
||||
// AttachResize is not available as the runtime is missing
|
||||
func (r *MissingRuntime) AttachResize(ctr *Container, newSize resize.TerminalSize) error {
|
||||
func (r *MissingRuntime) AttachResize(_ *Container, _ resize.TerminalSize) error {
|
||||
return r.printError()
|
||||
}
|
||||
|
||||
// ExecContainer is not available as the runtime is missing
|
||||
func (r *MissingRuntime) ExecContainer(ctr *Container, sessionID string, options *ExecOptions, streams *define.AttachStreams, newSize *resize.TerminalSize) (int, chan error, error) {
|
||||
func (r *MissingRuntime) ExecContainer(_ *Container, _ string, _ *ExecOptions, _ *define.AttachStreams, _ *resize.TerminalSize) (int, chan error, error) {
|
||||
return -1, nil, r.printError()
|
||||
}
|
||||
|
||||
// ExecContainerHTTP is not available as the runtime is missing
|
||||
func (r *MissingRuntime) ExecContainerHTTP(ctr *Container, sessionID string, options *ExecOptions, req *http.Request, w http.ResponseWriter,
|
||||
streams *HTTPAttachStreams, cancel <-chan bool, hijackDone chan<- bool, holdConnOpen <-chan bool, newSize *resize.TerminalSize) (int, chan error, error) {
|
||||
func (r *MissingRuntime) ExecContainerHTTP(_ *Container, _ string, _ *ExecOptions, _ *http.Request, _ http.ResponseWriter,
|
||||
_ *HTTPAttachStreams, _ <-chan bool, _ chan<- bool, _ <-chan bool, _ *resize.TerminalSize) (int, chan error, error) {
|
||||
return -1, nil, r.printError()
|
||||
}
|
||||
|
||||
// ExecContainerDetached is not available as the runtime is missing
|
||||
func (r *MissingRuntime) ExecContainerDetached(ctr *Container, sessionID string, options *ExecOptions, stdin bool) (int, error) {
|
||||
func (r *MissingRuntime) ExecContainerDetached(_ *Container, _ string, _ *ExecOptions, _ bool) (int, error) {
|
||||
return -1, r.printError()
|
||||
}
|
||||
|
||||
// ExecAttachResize is not available as the runtime is missing.
|
||||
func (r *MissingRuntime) ExecAttachResize(ctr *Container, sessionID string, newSize resize.TerminalSize) error {
|
||||
func (r *MissingRuntime) ExecAttachResize(_ *Container, _ string, _ resize.TerminalSize) error {
|
||||
return r.printError()
|
||||
}
|
||||
|
||||
@ -154,22 +154,22 @@ func (r *MissingRuntime) ExecAttachResize(ctr *Container, sessionID string, newS
|
||||
// TODO: We can also investigate using unix.Kill() on the PID of the exec
|
||||
// session here if we want to make stopping containers possible. Won't be
|
||||
// perfect, though.
|
||||
func (r *MissingRuntime) ExecStopContainer(ctr *Container, sessionID string, timeout uint) error {
|
||||
func (r *MissingRuntime) ExecStopContainer(_ *Container, _ string, _ uint) error {
|
||||
return r.printError()
|
||||
}
|
||||
|
||||
// ExecUpdateStatus is not available as the runtime is missing.
|
||||
func (r *MissingRuntime) ExecUpdateStatus(ctr *Container, sessionID string) (bool, error) {
|
||||
func (r *MissingRuntime) ExecUpdateStatus(_ *Container, _ string) (bool, error) {
|
||||
return false, r.printError()
|
||||
}
|
||||
|
||||
// CheckpointContainer is not available as the runtime is missing
|
||||
func (r *MissingRuntime) CheckpointContainer(ctr *Container, options ContainerCheckpointOptions) (int64, error) {
|
||||
func (r *MissingRuntime) CheckpointContainer(_ *Container, _ ContainerCheckpointOptions) (int64, error) {
|
||||
return 0, r.printError()
|
||||
}
|
||||
|
||||
// CheckConmonRunning is not available as the runtime is missing
|
||||
func (r *MissingRuntime) CheckConmonRunning(ctr *Container) (bool, error) {
|
||||
func (r *MissingRuntime) CheckConmonRunning(_ *Container) (bool, error) {
|
||||
return false, r.printError()
|
||||
}
|
||||
|
||||
@ -197,14 +197,14 @@ func (r *MissingRuntime) SupportsKVM() bool {
|
||||
// AttachSocketPath does not work as there is no runtime to attach to.
|
||||
// (Theoretically we could follow ExitFilePath but there is no guarantee the
|
||||
// container is running and thus has an attach socket...)
|
||||
func (r *MissingRuntime) AttachSocketPath(ctr *Container) (string, error) {
|
||||
func (r *MissingRuntime) AttachSocketPath(_ *Container) (string, error) {
|
||||
return "", r.printError()
|
||||
}
|
||||
|
||||
// ExecAttachSocketPath does not work as there is no runtime to attach to.
|
||||
// (Again, we could follow ExitFilePath, but no guarantee there is an existing
|
||||
// and running exec session)
|
||||
func (r *MissingRuntime) ExecAttachSocketPath(ctr *Container, sessionID string) (string, error) {
|
||||
func (r *MissingRuntime) ExecAttachSocketPath(_ *Container, _ string) (string, error) {
|
||||
return "", r.printError()
|
||||
}
|
||||
|
||||
|
@ -210,7 +210,7 @@ func newRuntimeFromConfig(ctx context.Context, conf *config.Config, options ...R
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if err := shutdown.Register("libpod", func(sig os.Signal) error {
|
||||
if err := shutdown.Register("libpod", func(_ os.Signal) error {
|
||||
if runtime.store != nil {
|
||||
_, _ = runtime.store.Shutdown(false)
|
||||
}
|
||||
@ -1304,7 +1304,7 @@ func (r *Runtime) PruneBuildContainers() ([]*reports.PruneReport, error) {
|
||||
|
||||
// SystemCheck checks our storage for consistency, and depending on the options
|
||||
// specified, will attempt to remove anything which fails consistency checks.
|
||||
func (r *Runtime) SystemCheck(ctx context.Context, options entities.SystemCheckOptions) (entities.SystemCheckReport, error) {
|
||||
func (r *Runtime) SystemCheck(_ context.Context, options entities.SystemCheckOptions) (entities.SystemCheckReport, error) {
|
||||
what := storage.CheckEverything()
|
||||
if options.Quick {
|
||||
// Turn off checking layer digests and layer contents to do quick check.
|
||||
|
@ -59,7 +59,7 @@ func (r *Runtime) NewContainer(ctx context.Context, rSpec *spec.Spec, spec *spec
|
||||
return r.newContainer(ctx, rSpec, options...)
|
||||
}
|
||||
|
||||
func (r *Runtime) PrepareVolumeOnCreateContainer(ctx context.Context, ctr *Container) error {
|
||||
func (r *Runtime) PrepareVolumeOnCreateContainer(_ context.Context, ctr *Container) error {
|
||||
// Copy the content from the underlying image into the newly created
|
||||
// volume if configured to do so.
|
||||
if !r.config.Containers.PrepareVolumeOnCreate {
|
||||
@ -117,7 +117,7 @@ func (r *Runtime) RestoreContainer(ctx context.Context, rSpec *spec.Spec, config
|
||||
|
||||
// RenameContainer renames the given container.
|
||||
// Returns a copy of the container that has been renamed if successful.
|
||||
func (r *Runtime) RenameContainer(ctx context.Context, ctr *Container, newName string) (*Container, error) {
|
||||
func (r *Runtime) RenameContainer(_ context.Context, ctr *Container, newName string) (*Container, error) {
|
||||
ctr.lock.Lock()
|
||||
defer ctr.lock.Unlock()
|
||||
|
||||
|
@ -2,9 +2,9 @@
|
||||
|
||||
package libpod
|
||||
|
||||
func checkCgroups2UnifiedMode(runtime *Runtime) {
|
||||
func checkCgroups2UnifiedMode(_ *Runtime) {
|
||||
}
|
||||
|
||||
func (r *Runtime) checkBootID(runtimeAliveFile string) error {
|
||||
func (r *Runtime) checkBootID(_ string) error {
|
||||
return nil
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ func (r *Runtime) GetRunningPods() ([]*Pod, error) {
|
||||
}
|
||||
|
||||
// PrunePods removes unused pods and their containers from local storage.
|
||||
func (r *Runtime) PrunePods(ctx context.Context) (map[string]error, error) {
|
||||
func (r *Runtime) PrunePods(_ context.Context) (map[string]error, error) {
|
||||
response := make(map[string]error)
|
||||
states := []string{define.PodStateStopped, define.PodStateExited}
|
||||
filterFunc := func(p *Pod) bool {
|
||||
|
@ -15,7 +15,7 @@ import (
|
||||
)
|
||||
|
||||
// NewPod makes a new, empty pod
|
||||
func (r *Runtime) NewPod(ctx context.Context, p specgen.PodSpecGenerator, options ...PodCreateOption) (_ *Pod, deferredErr error) {
|
||||
func (r *Runtime) NewPod(_ context.Context, p specgen.PodSpecGenerator, options ...PodCreateOption) (_ *Pod, deferredErr error) {
|
||||
if !r.valid {
|
||||
return nil, define.ErrRuntimeStopped
|
||||
}
|
||||
@ -94,7 +94,7 @@ func (r *Runtime) NewPod(ctx context.Context, p specgen.PodSpecGenerator, option
|
||||
}
|
||||
|
||||
// AddInfra adds the created infra container to the pod state
|
||||
func (r *Runtime) AddInfra(ctx context.Context, pod *Pod, infraCtr *Container) (*Pod, error) {
|
||||
func (r *Runtime) AddInfra(_ context.Context, pod *Pod, infraCtr *Container) (*Pod, error) {
|
||||
if !r.valid {
|
||||
return nil, define.ErrRuntimeStopped
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import (
|
||||
spec "github.com/opencontainers/runtime-spec/specs-go"
|
||||
)
|
||||
|
||||
func (r *Runtime) platformMakePod(pod *Pod, resourceLimits *spec.LinuxResources) (string, error) {
|
||||
func (r *Runtime) platformMakePod(_ *Pod, _ *spec.LinuxResources) (string, error) {
|
||||
return "", nil
|
||||
}
|
||||
|
||||
|
@ -306,7 +306,7 @@ func (s *SQLiteState) GetDBConfig() (*DBConfig, error) {
|
||||
}
|
||||
|
||||
// ValidateDBConfig validates paths in the given runtime against the database
|
||||
func (s *SQLiteState) ValidateDBConfig(runtime *Runtime) (defErr error) {
|
||||
func (s *SQLiteState) ValidateDBConfig(_ *Runtime) (defErr error) {
|
||||
if !s.valid {
|
||||
return define.ErrDBClosed
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ func TestGetContainerPodSameIDFails(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAddInvalidContainerFails(t *testing.T) {
|
||||
runForAllStates(t, func(t *testing.T, state State, manager lock.Manager) {
|
||||
runForAllStates(t, func(t *testing.T, state State, _ lock.Manager) {
|
||||
err := state.AddContainer(&Container{config: &ContainerConfig{ID: "1234"}})
|
||||
assert.Error(t, err)
|
||||
})
|
||||
@ -274,21 +274,21 @@ func TestAddCtrDepInPodFails(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetNonexistentContainerFails(t *testing.T) {
|
||||
runForAllStates(t, func(t *testing.T, state State, manager lock.Manager) {
|
||||
runForAllStates(t, func(t *testing.T, state State, _ lock.Manager) {
|
||||
_, err := state.Container("does not exist")
|
||||
assert.Error(t, err)
|
||||
})
|
||||
}
|
||||
|
||||
func TestGetContainerWithEmptyIDFails(t *testing.T) {
|
||||
runForAllStates(t, func(t *testing.T, state State, manager lock.Manager) {
|
||||
runForAllStates(t, func(t *testing.T, state State, _ lock.Manager) {
|
||||
_, err := state.Container("")
|
||||
assert.Error(t, err)
|
||||
})
|
||||
}
|
||||
|
||||
func TestLookupContainerWithEmptyIDFails(t *testing.T) {
|
||||
runForAllStates(t, func(t *testing.T, state State, manager lock.Manager) {
|
||||
runForAllStates(t, func(t *testing.T, state State, _ lock.Manager) {
|
||||
_, err := state.LookupContainer("")
|
||||
assert.Error(t, err)
|
||||
|
||||
@ -298,7 +298,7 @@ func TestLookupContainerWithEmptyIDFails(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestLookupNonexistentContainerFails(t *testing.T) {
|
||||
runForAllStates(t, func(t *testing.T, state State, manager lock.Manager) {
|
||||
runForAllStates(t, func(t *testing.T, state State, _ lock.Manager) {
|
||||
_, err := state.LookupContainer("does not exist")
|
||||
assert.Error(t, err)
|
||||
|
||||
@ -415,14 +415,14 @@ func TestLookupCtrByPodIDFails(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestHasContainerEmptyIDFails(t *testing.T) {
|
||||
runForAllStates(t, func(t *testing.T, state State, manager lock.Manager) {
|
||||
runForAllStates(t, func(t *testing.T, state State, _ lock.Manager) {
|
||||
_, err := state.HasContainer("")
|
||||
assert.Error(t, err)
|
||||
})
|
||||
}
|
||||
|
||||
func TestHasContainerNoSuchContainerReturnsFalse(t *testing.T) {
|
||||
runForAllStates(t, func(t *testing.T, state State, manager lock.Manager) {
|
||||
runForAllStates(t, func(t *testing.T, state State, _ lock.Manager) {
|
||||
exists, err := state.HasContainer("does not exist")
|
||||
assert.NoError(t, err)
|
||||
assert.False(t, exists)
|
||||
@ -494,14 +494,14 @@ func TestUpdateContainerNotInDatabaseReturnsError(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateInvalidContainerReturnsError(t *testing.T) {
|
||||
runForAllStates(t, func(t *testing.T, state State, manager lock.Manager) {
|
||||
runForAllStates(t, func(t *testing.T, state State, _ lock.Manager) {
|
||||
err := state.UpdateContainer(&Container{config: &ContainerConfig{ID: "1234"}})
|
||||
assert.Error(t, err)
|
||||
})
|
||||
}
|
||||
|
||||
func TestSaveInvalidContainerReturnsError(t *testing.T) {
|
||||
runForAllStates(t, func(t *testing.T, state State, manager lock.Manager) {
|
||||
runForAllStates(t, func(t *testing.T, state State, _ lock.Manager) {
|
||||
err := state.SaveContainer(&Container{config: &ContainerConfig{ID: "1234"}})
|
||||
assert.Error(t, err)
|
||||
})
|
||||
@ -551,7 +551,7 @@ func TestRemoveNonexistentContainerFails(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetAllContainersOnNewStateIsEmpty(t *testing.T) {
|
||||
runForAllStates(t, func(t *testing.T, state State, manager lock.Manager) {
|
||||
runForAllStates(t, func(t *testing.T, state State, _ lock.Manager) {
|
||||
ctrs, err := state.AllContainers(false)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, 0, len(ctrs))
|
||||
@ -594,7 +594,7 @@ func TestGetAllContainersTwoContainers(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestContainerInUseInvalidContainer(t *testing.T) {
|
||||
runForAllStates(t, func(t *testing.T, state State, manager lock.Manager) {
|
||||
runForAllStates(t, func(t *testing.T, state State, _ lock.Manager) {
|
||||
_, err := state.ContainerInUse(&Container{})
|
||||
assert.Error(t, err)
|
||||
})
|
||||
@ -930,7 +930,7 @@ func TestCannotUseBadIDAsGenericDependency(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRewriteContainerConfigDoesNotExist(t *testing.T) {
|
||||
runForAllStates(t, func(t *testing.T, state State, manager lock.Manager) {
|
||||
runForAllStates(t, func(t *testing.T, state State, _ lock.Manager) {
|
||||
err := state.RewriteContainerConfig(&Container{}, &ContainerConfig{})
|
||||
assert.Error(t, err)
|
||||
})
|
||||
@ -966,7 +966,7 @@ func TestRewriteContainerConfigRewritesConfig(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRewritePodConfigDoesNotExist(t *testing.T) {
|
||||
runForAllStates(t, func(t *testing.T, state State, manager lock.Manager) {
|
||||
runForAllStates(t, func(t *testing.T, state State, _ lock.Manager) {
|
||||
err := state.RewritePodConfig(&Pod{}, &PodConfig{})
|
||||
assert.Error(t, err)
|
||||
})
|
||||
@ -1002,14 +1002,14 @@ func TestRewritePodConfigRewritesConfig(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetPodDoesNotExist(t *testing.T) {
|
||||
runForAllStates(t, func(t *testing.T, state State, manager lock.Manager) {
|
||||
runForAllStates(t, func(t *testing.T, state State, _ lock.Manager) {
|
||||
_, err := state.Pod("doesnotexist")
|
||||
assert.Error(t, err)
|
||||
})
|
||||
}
|
||||
|
||||
func TestGetPodEmptyID(t *testing.T) {
|
||||
runForAllStates(t, func(t *testing.T, state State, manager lock.Manager) {
|
||||
runForAllStates(t, func(t *testing.T, state State, _ lock.Manager) {
|
||||
_, err := state.Pod("")
|
||||
assert.Error(t, err)
|
||||
})
|
||||
@ -1084,14 +1084,14 @@ func TestGetPodByCtrID(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestLookupPodEmptyID(t *testing.T) {
|
||||
runForAllStates(t, func(t *testing.T, state State, manager lock.Manager) {
|
||||
runForAllStates(t, func(t *testing.T, state State, _ lock.Manager) {
|
||||
_, err := state.LookupPod("")
|
||||
assert.Error(t, err)
|
||||
})
|
||||
}
|
||||
|
||||
func TestLookupNotExistPod(t *testing.T) {
|
||||
runForAllStates(t, func(t *testing.T, state State, manager lock.Manager) {
|
||||
runForAllStates(t, func(t *testing.T, state State, _ lock.Manager) {
|
||||
_, err := state.LookupPod("doesnotexist")
|
||||
assert.Error(t, err)
|
||||
})
|
||||
@ -1188,14 +1188,14 @@ func TestLookupPodByCtrName(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestHasPodEmptyIDErrors(t *testing.T) {
|
||||
runForAllStates(t, func(t *testing.T, state State, manager lock.Manager) {
|
||||
runForAllStates(t, func(t *testing.T, state State, _ lock.Manager) {
|
||||
_, err := state.HasPod("")
|
||||
assert.Error(t, err)
|
||||
})
|
||||
}
|
||||
|
||||
func TestHasPodNoSuchPod(t *testing.T) {
|
||||
runForAllStates(t, func(t *testing.T, state State, manager lock.Manager) {
|
||||
runForAllStates(t, func(t *testing.T, state State, _ lock.Manager) {
|
||||
exist, err := state.HasPod("nonexistent")
|
||||
assert.NoError(t, err)
|
||||
assert.False(t, exist)
|
||||
@ -1245,7 +1245,7 @@ func TestHasPodCtrIDFalse(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAddPodInvalidPodErrors(t *testing.T) {
|
||||
runForAllStates(t, func(t *testing.T, state State, manager lock.Manager) {
|
||||
runForAllStates(t, func(t *testing.T, state State, _ lock.Manager) {
|
||||
err := state.AddPod(&Pod{config: &PodConfig{}})
|
||||
assert.Error(t, err)
|
||||
})
|
||||
@ -1368,7 +1368,7 @@ func TestAddPodCtrNameConflictFails(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRemovePodInvalidPodErrors(t *testing.T) {
|
||||
runForAllStates(t, func(t *testing.T, state State, manager lock.Manager) {
|
||||
runForAllStates(t, func(t *testing.T, state State, _ lock.Manager) {
|
||||
err := state.RemovePod(&Pod{config: &PodConfig{}})
|
||||
assert.Error(t, err)
|
||||
})
|
||||
@ -1479,7 +1479,7 @@ func TestRemovePodAfterEmptySucceeds(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAllPodsEmptyOnEmptyState(t *testing.T) {
|
||||
runForAllStates(t, func(t *testing.T, state State, manager lock.Manager) {
|
||||
runForAllStates(t, func(t *testing.T, state State, _ lock.Manager) {
|
||||
allPods, err := state.AllPods()
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, 0, len(allPods))
|
||||
@ -1541,7 +1541,7 @@ func TestAllPodsMultiplePods(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPodHasContainerNoSuchPod(t *testing.T) {
|
||||
runForAllStates(t, func(t *testing.T, state State, manager lock.Manager) {
|
||||
runForAllStates(t, func(t *testing.T, state State, _ lock.Manager) {
|
||||
_, err := state.PodHasContainer(&Pod{config: &PodConfig{}}, strings.Repeat("0", 32))
|
||||
assert.Error(t, err)
|
||||
})
|
||||
@ -1617,7 +1617,7 @@ func TestPodHasContainerSucceeds(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPodContainersByIDInvalidPod(t *testing.T) {
|
||||
runForAllStates(t, func(t *testing.T, state State, manager lock.Manager) {
|
||||
runForAllStates(t, func(t *testing.T, state State, _ lock.Manager) {
|
||||
_, err := state.PodContainersByID(&Pod{config: &PodConfig{}})
|
||||
assert.Error(t, err)
|
||||
})
|
||||
@ -1719,7 +1719,7 @@ func TestPodContainersByIDMultipleContainers(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPodContainersInvalidPod(t *testing.T) {
|
||||
runForAllStates(t, func(t *testing.T, state State, manager lock.Manager) {
|
||||
runForAllStates(t, func(t *testing.T, state State, _ lock.Manager) {
|
||||
_, err := state.PodContainers(&Pod{config: &PodConfig{}})
|
||||
assert.Error(t, err)
|
||||
})
|
||||
@ -1822,7 +1822,7 @@ func TestPodContainersMultipleContainers(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRemovePodContainersInvalidPod(t *testing.T) {
|
||||
runForAllStates(t, func(t *testing.T, state State, manager lock.Manager) {
|
||||
runForAllStates(t, func(t *testing.T, state State, _ lock.Manager) {
|
||||
err := state.RemovePodContainers(&Pod{config: &PodConfig{}})
|
||||
assert.Error(t, err)
|
||||
})
|
||||
@ -2508,7 +2508,7 @@ func TestRemoveContainerFromPodWithDependencySucceedsAfterDepRemoved(t *testing.
|
||||
}
|
||||
|
||||
func TestUpdatePodInvalidPod(t *testing.T) {
|
||||
runForAllStates(t, func(t *testing.T, state State, manager lock.Manager) {
|
||||
runForAllStates(t, func(t *testing.T, state State, _ lock.Manager) {
|
||||
err := state.UpdatePod(&Pod{config: &PodConfig{}})
|
||||
assert.Error(t, err)
|
||||
})
|
||||
@ -2525,7 +2525,7 @@ func TestUpdatePodPodNotInStateFails(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSavePodInvalidPod(t *testing.T) {
|
||||
runForAllStates(t, func(t *testing.T, state State, manager lock.Manager) {
|
||||
runForAllStates(t, func(t *testing.T, state State, _ lock.Manager) {
|
||||
err := state.SavePod(&Pod{config: &PodConfig{}})
|
||||
assert.Error(t, err)
|
||||
})
|
||||
@ -2581,13 +2581,13 @@ func TestGetContainerConfigSucceeds(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetContainerConfigEmptyIDFails(t *testing.T) {
|
||||
runForAllStates(t, func(t *testing.T, state State, manager lock.Manager) {
|
||||
runForAllStates(t, func(t *testing.T, state State, _ lock.Manager) {
|
||||
_, err := state.GetContainerConfig("")
|
||||
assert.Error(t, err)
|
||||
})
|
||||
}
|
||||
func TestGetContainerConfigNonExistentIDFails(t *testing.T) {
|
||||
runForAllStates(t, func(t *testing.T, state State, manager lock.Manager) {
|
||||
runForAllStates(t, func(t *testing.T, state State, _ lock.Manager) {
|
||||
_, err := state.GetContainerConfig("does not exist")
|
||||
assert.Error(t, err)
|
||||
})
|
||||
|
@ -10,7 +10,7 @@ import (
|
||||
)
|
||||
|
||||
// No equivalent on FreeBSD?
|
||||
func LabelVolumePath(path, mountLabel string) error {
|
||||
func LabelVolumePath(_, _ string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -21,17 +21,17 @@ func TestLabelVolumePath(t *testing.T) {
|
||||
}()
|
||||
|
||||
// Relabel returns ENOTSUP unconditionally.
|
||||
lvpRelabel = func(path string, fileLabel string, shared bool) error {
|
||||
lvpRelabel = func(_ string, _ string, _ bool) error {
|
||||
return syscall.ENOTSUP
|
||||
}
|
||||
|
||||
// InitLabels and ReleaseLabel both return dummy values and nil errors.
|
||||
lvpInitLabels = func(options []string) (string, string, error) {
|
||||
lvpInitLabels = func(_ []string) (string, string, error) {
|
||||
pLabel := "system_u:system_r:container_t:s0:c1,c2"
|
||||
mLabel := "system_u:object_r:container_file_t:s0:c1,c2"
|
||||
return pLabel, mLabel, nil
|
||||
}
|
||||
lvpReleaseLabel = func(label string) {}
|
||||
lvpReleaseLabel = func(_ string) {}
|
||||
|
||||
// LabelVolumePath should not return an error if the operation is unsupported.
|
||||
err := LabelVolumePath("/foo/bar", "")
|
||||
|
Reference in New Issue
Block a user