mirror of
https://github.com/containers/podman.git
synced 2025-05-18 23:57:22 +08:00
Merge pull request #18931 from vrothberg/lint
bump golangci-lint to v1.53.3
This commit is contained in:
@ -12,7 +12,12 @@ run:
|
|||||||
linters:
|
linters:
|
||||||
enable-all: true
|
enable-all: true
|
||||||
disable:
|
disable:
|
||||||
# All these break for one reason or another
|
# too many reports but requires attention
|
||||||
|
- depguard
|
||||||
|
- tagalign
|
||||||
|
# useful hints that should be addressed
|
||||||
|
- nakedret
|
||||||
|
- gosmopolitan # usage of time.Local in pkg/k8s.io
|
||||||
- tagliatelle # too many JSON keys cannot be changed due to compat
|
- tagliatelle # too many JSON keys cannot be changed due to compat
|
||||||
- nosnakecase # too many false positives due to the `unix` package
|
- nosnakecase # too many false positives due to the `unix` package
|
||||||
- dupword # too many false positives (e.g., in tests)
|
- dupword # too many false positives (e.g., in tests)
|
||||||
@ -73,7 +78,12 @@ linters-settings:
|
|||||||
ignore: fmt:.*
|
ignore: fmt:.*
|
||||||
nolintlint:
|
nolintlint:
|
||||||
allow-leading-space: false
|
allow-leading-space: false
|
||||||
|
allow-unused: true
|
||||||
require-specific: true
|
require-specific: true
|
||||||
|
revive:
|
||||||
|
rules:
|
||||||
|
- name: unused-parameter
|
||||||
|
disabled: true
|
||||||
|
|
||||||
issues:
|
issues:
|
||||||
# Maximum issues count per one linter.
|
# Maximum issues count per one linter.
|
||||||
|
2
Makefile
2
Makefile
@ -941,7 +941,7 @@ install.tools: .install.golangci-lint ## Install needed tools
|
|||||||
|
|
||||||
.PHONY: .install.golangci-lint
|
.PHONY: .install.golangci-lint
|
||||||
.install.golangci-lint:
|
.install.golangci-lint:
|
||||||
VERSION=1.51.1 ./hack/install_golangci.sh
|
VERSION=1.53.3 ./hack/install_golangci.sh
|
||||||
|
|
||||||
.PHONY: .install.swagger
|
.PHONY: .install.swagger
|
||||||
.install.swagger:
|
.install.swagger:
|
||||||
|
@ -106,7 +106,7 @@ func add(cmd *cobra.Command, args []string) error {
|
|||||||
Default: cOpts.Default,
|
Default: cOpts.Default,
|
||||||
}
|
}
|
||||||
dest := args[1]
|
dest := args[1]
|
||||||
if match, err := regexp.Match("^[A-Za-z][A-Za-z0-9+.-]*://", []byte(dest)); err != nil {
|
if match, err := regexp.MatchString("^[A-Za-z][A-Za-z0-9+.-]*://", dest); err != nil {
|
||||||
return fmt.Errorf("invalid destination: %w", err)
|
return fmt.Errorf("invalid destination: %w", err)
|
||||||
} else if !match {
|
} else if !match {
|
||||||
dest = "ssh://" + dest
|
dest = "ssh://" + dest
|
||||||
@ -203,7 +203,7 @@ func create(cmd *cobra.Command, args []string) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if match, err := regexp.Match("^[A-Za-z][A-Za-z0-9+.-]*://", []byte(dest)); err != nil {
|
if match, err := regexp.MatchString("^[A-Za-z][A-Za-z0-9+.-]*://", dest); err != nil {
|
||||||
return fmt.Errorf("invalid destination: %w", err)
|
return fmt.Errorf("invalid destination: %w", err)
|
||||||
} else if !match {
|
} else if !match {
|
||||||
dest = "ssh://" + dest
|
dest = "ssh://" + dest
|
||||||
|
@ -64,7 +64,7 @@ func logToKmsg(s string) bool {
|
|||||||
kmsgFile = f
|
kmsgFile = f
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, err := kmsgFile.Write([]byte(s)); err != nil {
|
if _, err := kmsgFile.WriteString(s); err != nil {
|
||||||
kmsgFile.Close()
|
kmsgFile.Close()
|
||||||
kmsgFile = nil
|
kmsgFile = nil
|
||||||
return false
|
return false
|
||||||
|
@ -2463,7 +2463,6 @@ func (c *Container) setHomeEnvIfNeeded() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Ensure HOME is not already set in Env
|
// Ensure HOME is not already set in Env
|
||||||
home := ""
|
|
||||||
for _, s := range c.config.Spec.Process.Env {
|
for _, s := range c.config.Spec.Process.Env {
|
||||||
if strings.HasPrefix(s, "HOME=") {
|
if strings.HasPrefix(s, "HOME=") {
|
||||||
return nil
|
return nil
|
||||||
|
@ -750,7 +750,7 @@ func (c *Container) safeMountSubPath(mountPoint, subpath string) (s *safeMountIn
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
npath := ""
|
var npath string
|
||||||
switch {
|
switch {
|
||||||
case fi.Mode()&fs.ModeSymlink != 0:
|
case fi.Mode()&fs.ModeSymlink != 0:
|
||||||
return nil, fmt.Errorf("file %q is a symlink", joinedPath)
|
return nil, fmt.Errorf("file %q is a symlink", joinedPath)
|
||||||
|
@ -343,7 +343,7 @@ func generateResourceFile(res *spec.LinuxResources) (string, []string, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return "", nil, err
|
return "", nil, err
|
||||||
}
|
}
|
||||||
_, err = f.WriteString(string(j))
|
_, err = f.Write(j)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", nil, err
|
return "", nil, err
|
||||||
}
|
}
|
||||||
@ -1488,7 +1488,7 @@ func readConmonPipeData(runtimeName string, pipe *os.File, ociLog string) (int,
|
|||||||
ch <- syncStruct{si: si}
|
ch <- syncStruct{si: si}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
data := -1
|
var data int
|
||||||
select {
|
select {
|
||||||
case ss := <-ch:
|
case ss := <-ch:
|
||||||
if ss.err != nil {
|
if ss.err != nil {
|
||||||
|
@ -139,6 +139,9 @@ func (s *SQLiteState) Refresh() (defErr error) {
|
|||||||
|
|
||||||
ctrStates[id] = string(newJSON)
|
ctrStates[id] = string(newJSON)
|
||||||
}
|
}
|
||||||
|
if err := ctrRows.Err(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
podRows, err := s.conn.Query("SELECT ID, JSON FROM PodState;")
|
podRows, err := s.conn.Query("SELECT ID, JSON FROM PodState;")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -170,6 +173,9 @@ func (s *SQLiteState) Refresh() (defErr error) {
|
|||||||
|
|
||||||
podStates[id] = string(newJSON)
|
podStates[id] = string(newJSON)
|
||||||
}
|
}
|
||||||
|
if err := podRows.Err(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
volRows, err := s.conn.Query("SELECT Name, JSON FROM VolumeState;")
|
volRows, err := s.conn.Query("SELECT Name, JSON FROM VolumeState;")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -202,6 +208,9 @@ func (s *SQLiteState) Refresh() (defErr error) {
|
|||||||
|
|
||||||
volumeStates[name] = string(newJSON)
|
volumeStates[name] = string(newJSON)
|
||||||
}
|
}
|
||||||
|
if err := volRows.Err(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
// Write updated states back to DB, and perform additional maintenance
|
// Write updated states back to DB, and perform additional maintenance
|
||||||
// (Remove exit codes and exec sessions)
|
// (Remove exit codes and exec sessions)
|
||||||
@ -503,6 +512,9 @@ func (s *SQLiteState) LookupContainerID(idOrName string) (string, error) {
|
|||||||
}
|
}
|
||||||
resCount++
|
resCount++
|
||||||
}
|
}
|
||||||
|
if err := rows.Err(); err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
if resCount == 0 {
|
if resCount == 0 {
|
||||||
return "", define.ErrNoSuchCtr
|
return "", define.ErrNoSuchCtr
|
||||||
} else if resCount > 1 {
|
} else if resCount > 1 {
|
||||||
@ -544,6 +556,9 @@ func (s *SQLiteState) LookupContainer(idOrName string) (*Container, error) {
|
|||||||
}
|
}
|
||||||
resCount++
|
resCount++
|
||||||
}
|
}
|
||||||
|
if err := rows.Err(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
if !exactName {
|
if !exactName {
|
||||||
if resCount == 0 {
|
if resCount == 0 {
|
||||||
return nil, fmt.Errorf("no container with name or ID %q found: %w", idOrName, define.ErrNoSuchCtr)
|
return nil, fmt.Errorf("no container with name or ID %q found: %w", idOrName, define.ErrNoSuchCtr)
|
||||||
@ -730,6 +745,9 @@ func (s *SQLiteState) ContainerInUse(ctr *Container) ([]string, error) {
|
|||||||
}
|
}
|
||||||
deps = append(deps, dep)
|
deps = append(deps, dep)
|
||||||
}
|
}
|
||||||
|
if err := rows.Err(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
return deps, nil
|
return deps, nil
|
||||||
}
|
}
|
||||||
@ -770,6 +788,9 @@ func (s *SQLiteState) AllContainers(loadState bool) ([]*Container, error) {
|
|||||||
|
|
||||||
ctrs = append(ctrs, ctr)
|
ctrs = append(ctrs, ctr)
|
||||||
}
|
}
|
||||||
|
if err := rows.Err(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
rows, err := s.conn.Query("SELECT JSON FROM ContainerConfig;")
|
rows, err := s.conn.Query("SELECT JSON FROM ContainerConfig;")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -794,6 +815,9 @@ func (s *SQLiteState) AllContainers(loadState bool) ([]*Container, error) {
|
|||||||
|
|
||||||
ctrs = append(ctrs, ctr)
|
ctrs = append(ctrs, ctr)
|
||||||
}
|
}
|
||||||
|
if err := rows.Err(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, ctr := range ctrs {
|
for _, ctr := range ctrs {
|
||||||
@ -1095,6 +1119,9 @@ func (s *SQLiteState) GetContainerExecSessions(ctr *Container) ([]string, error)
|
|||||||
}
|
}
|
||||||
sessions = append(sessions, session)
|
sessions = append(sessions, session)
|
||||||
}
|
}
|
||||||
|
if err := rows.Err(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
return sessions, nil
|
return sessions, nil
|
||||||
}
|
}
|
||||||
@ -1332,6 +1359,9 @@ func (s *SQLiteState) LookupPod(idOrName string) (*Pod, error) {
|
|||||||
}
|
}
|
||||||
resCount++
|
resCount++
|
||||||
}
|
}
|
||||||
|
if err := rows.Err(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
if !exactName {
|
if !exactName {
|
||||||
if resCount == 0 {
|
if resCount == 0 {
|
||||||
return nil, fmt.Errorf("no pod with name or ID %s found: %w", idOrName, define.ErrNoSuchPod)
|
return nil, fmt.Errorf("no pod with name or ID %s found: %w", idOrName, define.ErrNoSuchPod)
|
||||||
@ -1421,6 +1451,9 @@ func (s *SQLiteState) PodContainersByID(pod *Pod) ([]string, error) {
|
|||||||
|
|
||||||
ids = append(ids, id)
|
ids = append(ids, id)
|
||||||
}
|
}
|
||||||
|
if err := rows.Err(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
return ids, nil
|
return ids, nil
|
||||||
}
|
}
|
||||||
@ -1459,6 +1492,9 @@ func (s *SQLiteState) PodContainers(pod *Pod) ([]*Container, error) {
|
|||||||
|
|
||||||
ctrs = append(ctrs, ctr)
|
ctrs = append(ctrs, ctr)
|
||||||
}
|
}
|
||||||
|
if err := rows.Err(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
for _, ctr := range ctrs {
|
for _, ctr := range ctrs {
|
||||||
if err := finalizeCtrSqlite(ctr); err != nil {
|
if err := finalizeCtrSqlite(ctr); err != nil {
|
||||||
@ -1652,6 +1688,9 @@ func (s *SQLiteState) RemovePodContainers(pod *Pod) (defErr error) {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if err := rows.Err(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -1804,6 +1843,9 @@ func (s *SQLiteState) AllPods() ([]*Pod, error) {
|
|||||||
|
|
||||||
pods = append(pods, pod)
|
pods = append(pods, pod)
|
||||||
}
|
}
|
||||||
|
if err := rows.Err(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
return pods, nil
|
return pods, nil
|
||||||
}
|
}
|
||||||
@ -1910,6 +1952,9 @@ func (s *SQLiteState) RemoveVolume(volume *Volume) (defErr error) {
|
|||||||
}
|
}
|
||||||
ctrs = append(ctrs, ctr)
|
ctrs = append(ctrs, ctr)
|
||||||
}
|
}
|
||||||
|
if err := rows.Err(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
if len(ctrs) > 0 {
|
if len(ctrs) > 0 {
|
||||||
return fmt.Errorf("volume %s is in use by containers %s: %w", volume.Name(), strings.Join(ctrs, ","), define.ErrVolumeBeingUsed)
|
return fmt.Errorf("volume %s is in use by containers %s: %w", volume.Name(), strings.Join(ctrs, ","), define.ErrVolumeBeingUsed)
|
||||||
}
|
}
|
||||||
@ -2045,6 +2090,9 @@ func (s *SQLiteState) AllVolumes() ([]*Volume, error) {
|
|||||||
|
|
||||||
volumes = append(volumes, vol)
|
volumes = append(volumes, vol)
|
||||||
}
|
}
|
||||||
|
if err := rows.Err(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
return volumes, nil
|
return volumes, nil
|
||||||
}
|
}
|
||||||
@ -2113,6 +2161,9 @@ func (s *SQLiteState) LookupVolume(name string) (*Volume, error) {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if err := rows.Err(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
if foundName == "" {
|
if foundName == "" {
|
||||||
return nil, fmt.Errorf("no volume with name %q found: %w", name, define.ErrNoSuchVolume)
|
return nil, fmt.Errorf("no volume with name %q found: %w", name, define.ErrNoSuchVolume)
|
||||||
}
|
}
|
||||||
@ -2186,6 +2237,9 @@ func (s *SQLiteState) VolumeInUse(volume *Volume) ([]string, error) {
|
|||||||
}
|
}
|
||||||
ctrs = append(ctrs, ctr)
|
ctrs = append(ctrs, ctr)
|
||||||
}
|
}
|
||||||
|
if err := rows.Err(); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
return ctrs, nil
|
return ctrs, nil
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
package e2e_test
|
package e2e_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/containers/podman/v4/pkg/machine"
|
"github.com/containers/podman/v4/pkg/machine"
|
||||||
jsoniter "github.com/json-iterator/go"
|
jsoniter "github.com/json-iterator/go"
|
||||||
|
|
||||||
@ -67,7 +65,7 @@ var _ = Describe("podman machine stop", func() {
|
|||||||
var inspectInfo []machine.InspectInfo
|
var inspectInfo []machine.InspectInfo
|
||||||
err = jsoniter.Unmarshal(inspectSession.Bytes(), &inspectInfo)
|
err = jsoniter.Unmarshal(inspectSession.Bytes(), &inspectInfo)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(strings.HasSuffix(inspectInfo[0].ConnectionInfo.PodmanSocket.GetPath(), "podman.sock"))
|
Expect(inspectInfo[0].ConnectionInfo.PodmanSocket.GetPath()).To(HaveSuffix("podman.sock"))
|
||||||
|
|
||||||
inspect := new(inspectMachine)
|
inspect := new(inspectMachine)
|
||||||
inspect = inspect.withFormat("{{.Name}}")
|
inspect = inspect.withFormat("{{.Name}}")
|
||||||
|
@ -52,12 +52,12 @@ var _ = Describe("podman machine list", func() {
|
|||||||
firstList, err := mb.setCmd(list.withQuiet()).run()
|
firstList, err := mb.setCmd(list.withQuiet()).run()
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
Expect(firstList).Should(Exit(0))
|
Expect(firstList).Should(Exit(0))
|
||||||
Expect(firstList.outputToStringSlice()).To(HaveLen(0)) // No header with quiet
|
Expect(firstList.outputToStringSlice()).To(BeEmpty()) // No header with quiet
|
||||||
|
|
||||||
noheaderSession, err := mb.setCmd(list.withNoHeading()).run() // noheader
|
noheaderSession, err := mb.setCmd(list.withNoHeading()).run() // noheader
|
||||||
Expect(err).NotTo(HaveOccurred())
|
Expect(err).NotTo(HaveOccurred())
|
||||||
Expect(noheaderSession).Should(Exit(0))
|
Expect(noheaderSession).Should(Exit(0))
|
||||||
Expect(noheaderSession.outputToStringSlice()).To(HaveLen(0))
|
Expect(noheaderSession.outputToStringSlice()).To(BeEmpty())
|
||||||
|
|
||||||
i := new(initMachine)
|
i := new(initMachine)
|
||||||
session, err := mb.setName(name1).setCmd(i.withImagePath(mb.imagePath)).run()
|
session, err := mb.setName(name1).setCmd(i.withImagePath(mb.imagePath)).run()
|
||||||
|
@ -374,7 +374,7 @@ func becomeRootInUserNS(pausePid, fileToRead string, fileOutput *os.File) (_ boo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = w.Write([]byte("0"))
|
_, err = w.WriteString("0")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, -1, fmt.Errorf("write to sync pipe: %w", err)
|
return false, -1, fmt.Errorf("write to sync pipe: %w", err)
|
||||||
}
|
}
|
||||||
|
@ -313,9 +313,10 @@ var _ = Describe("Podman create", func() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
It("podman create --authfile with nonexistent authfile", func() {
|
It("podman create --authfile with nonexistent authfile", func() {
|
||||||
|
// FIXME (#18938): this test should fail but does not!
|
||||||
session := podmanTest.Podman([]string{"create", "--authfile", "/tmp/nonexistent", "--name=foo", ALPINE})
|
session := podmanTest.Podman([]string{"create", "--authfile", "/tmp/nonexistent", "--name=foo", ALPINE})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).To(Not(Equal(0)))
|
Expect(session).Should(Exit(0))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman create --signature-policy", func() {
|
It("podman create --signature-policy", func() {
|
||||||
|
@ -182,7 +182,7 @@ var _ = Describe("Podman kube generate", func() {
|
|||||||
err := yaml.Unmarshal(kube.Out.Contents(), pod)
|
err := yaml.Unmarshal(kube.Out.Contents(), pod)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
Expect(pod.Spec).To(HaveField("HostNetwork", false))
|
Expect(pod.Spec).To(HaveField("HostNetwork", false))
|
||||||
Expect(pod.Annotations).To(HaveLen(0))
|
Expect(pod.Annotations).To(BeEmpty())
|
||||||
|
|
||||||
numContainers := 0
|
numContainers := 0
|
||||||
for range pod.Spec.Containers {
|
for range pod.Spec.Containers {
|
||||||
|
@ -192,7 +192,7 @@ WORKDIR /test
|
|||||||
result := podmanTest.Podman([]string{"images", "-q", "-f", "dangling=true"})
|
result := podmanTest.Podman([]string{"images", "-q", "-f", "dangling=true"})
|
||||||
result.WaitWithDefaultTimeout()
|
result.WaitWithDefaultTimeout()
|
||||||
Expect(result).Should(Exit(0), "dangling image output: %q", result.OutputToString())
|
Expect(result).Should(Exit(0), "dangling image output: %q", result.OutputToString())
|
||||||
Expect(result.OutputToStringArray()).Should(HaveLen(0), "dangling image output: %q", result.OutputToString())
|
Expect(result.OutputToStringArray()).Should(BeEmpty(), "dangling image output: %q", result.OutputToString())
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman pull by digest and list --all", func() {
|
It("podman pull by digest and list --all", func() {
|
||||||
|
@ -571,7 +571,7 @@ var _ = Describe("Podman inspect", func() {
|
|||||||
session = podmanTest.Podman([]string{"container", "inspect", cid, "-f", "{{ .State.Error }}"})
|
session = podmanTest.Podman([]string{"container", "inspect", cid, "-f", "{{ .State.Error }}"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(Exit(0))
|
||||||
Expect(session.OutputToString()).To(HaveLen(0))
|
Expect(session.OutputToString()).To(BeEmpty())
|
||||||
|
|
||||||
session = podmanTest.Podman([]string{"start", cid})
|
session = podmanTest.Podman([]string{"start", cid})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
@ -579,7 +579,7 @@ var _ = Describe("Podman inspect", func() {
|
|||||||
session = podmanTest.Podman([]string{"container", "inspect", cid, "-f", "'{{ .State.Error }}"})
|
session = podmanTest.Podman([]string{"container", "inspect", cid, "-f", "'{{ .State.Error }}"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(Exit(0))
|
||||||
Expect(session.OutputToString()).To(Not(HaveLen(0)))
|
Expect(session.OutputToString()).ToNot(BeEmpty())
|
||||||
})
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
|
@ -569,7 +569,7 @@ var _ = Describe("Podman network", func() {
|
|||||||
Expect(result).To(HaveField("Driver", "macvlan"))
|
Expect(result).To(HaveField("Driver", "macvlan"))
|
||||||
Expect(result).To(HaveField("NetworkInterface", "lo"))
|
Expect(result).To(HaveField("NetworkInterface", "lo"))
|
||||||
Expect(result.IPAMOptions).To(HaveKeyWithValue("driver", "dhcp"))
|
Expect(result.IPAMOptions).To(HaveKeyWithValue("driver", "dhcp"))
|
||||||
Expect(result.Subnets).To(HaveLen(0))
|
Expect(result.Subnets).To(BeEmpty())
|
||||||
|
|
||||||
nc = podmanTest.Podman([]string{"network", "rm", net})
|
nc = podmanTest.Podman([]string{"network", "rm", net})
|
||||||
nc.WaitWithDefaultTimeout()
|
nc.WaitWithDefaultTimeout()
|
||||||
@ -599,7 +599,7 @@ var _ = Describe("Podman network", func() {
|
|||||||
Expect(result).To(HaveField("Driver", "ipvlan"))
|
Expect(result).To(HaveField("Driver", "ipvlan"))
|
||||||
Expect(result).To(HaveField("NetworkInterface", "lo"))
|
Expect(result).To(HaveField("NetworkInterface", "lo"))
|
||||||
Expect(result.IPAMOptions).To(HaveKeyWithValue("driver", "dhcp"))
|
Expect(result.IPAMOptions).To(HaveKeyWithValue("driver", "dhcp"))
|
||||||
Expect(result.Subnets).To(HaveLen(0))
|
Expect(result.Subnets).To(BeEmpty())
|
||||||
|
|
||||||
nc = podmanTest.Podman([]string{"network", "rm", net})
|
nc = podmanTest.Podman([]string{"network", "rm", net})
|
||||||
nc.WaitWithDefaultTimeout()
|
nc.WaitWithDefaultTimeout()
|
||||||
|
@ -464,7 +464,7 @@ var _ = Describe("Podman pause", func() {
|
|||||||
session1 = podmanTest.Podman([]string{"pause", "-a", "--filter", fmt.Sprintf("id=%swrongid", shortCid3)})
|
session1 = podmanTest.Podman([]string{"pause", "-a", "--filter", fmt.Sprintf("id=%swrongid", shortCid3)})
|
||||||
session1.WaitWithDefaultTimeout()
|
session1.WaitWithDefaultTimeout()
|
||||||
Expect(session1).Should(Exit(0))
|
Expect(session1).Should(Exit(0))
|
||||||
Expect(session1.OutputToString()).To(HaveLen(0))
|
Expect(session1.OutputToString()).To(BeEmpty())
|
||||||
|
|
||||||
session1 = podmanTest.Podman([]string{"pause", "-a", "--filter", fmt.Sprintf("id=%s", shortCid3)})
|
session1 = podmanTest.Podman([]string{"pause", "-a", "--filter", fmt.Sprintf("id=%s", shortCid3)})
|
||||||
session1.WaitWithDefaultTimeout()
|
session1.WaitWithDefaultTimeout()
|
||||||
@ -474,7 +474,7 @@ var _ = Describe("Podman pause", func() {
|
|||||||
session1 = podmanTest.Podman([]string{"unpause", "-a", "--filter", fmt.Sprintf("id=%swrongid", shortCid3)})
|
session1 = podmanTest.Podman([]string{"unpause", "-a", "--filter", fmt.Sprintf("id=%swrongid", shortCid3)})
|
||||||
session1.WaitWithDefaultTimeout()
|
session1.WaitWithDefaultTimeout()
|
||||||
Expect(session1).Should(Exit(0))
|
Expect(session1).Should(Exit(0))
|
||||||
Expect(session1.OutputToString()).To(HaveLen(0))
|
Expect(session1.OutputToString()).To(BeEmpty())
|
||||||
|
|
||||||
session1 = podmanTest.Podman([]string{"unpause", "-a", "--filter", fmt.Sprintf("id=%s", shortCid3)})
|
session1 = podmanTest.Podman([]string{"unpause", "-a", "--filter", fmt.Sprintf("id=%s", shortCid3)})
|
||||||
session1.WaitWithDefaultTimeout()
|
session1.WaitWithDefaultTimeout()
|
||||||
|
@ -1739,7 +1739,7 @@ func createSourceTarFile(fileName, fileContent, tarFilePath string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = file.Write([]byte(fileContent))
|
_, err = file.WriteString(fileContent)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -3665,7 +3665,7 @@ o: {{ .Options.o }}`})
|
|||||||
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
|
kube := podmanTest.Podman([]string{"play", "kube", kubeYaml})
|
||||||
kube.WaitWithDefaultTimeout()
|
kube.WaitWithDefaultTimeout()
|
||||||
if IsRemote() {
|
if IsRemote() {
|
||||||
Expect(kube).Error()
|
Expect(kube).Should(Exit(125))
|
||||||
Expect(kube.ErrorToString()).To(ContainSubstring("importing volumes is not supported for remote requests"))
|
Expect(kube.ErrorToString()).To(ContainSubstring("importing volumes is not supported for remote requests"))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -4947,7 +4947,7 @@ spec:
|
|||||||
ps := podmanTest.Podman([]string{"pod", "ps", "-q"})
|
ps := podmanTest.Podman([]string{"pod", "ps", "-q"})
|
||||||
ps.WaitWithDefaultTimeout()
|
ps.WaitWithDefaultTimeout()
|
||||||
Expect(ps).Should(Exit(0))
|
Expect(ps).Should(Exit(0))
|
||||||
Expect(ps.OutputToStringArray()).To(HaveLen(0))
|
Expect(ps.OutputToStringArray()).To(BeEmpty())
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman play kube with named volume subpaths", func() {
|
It("podman play kube with named volume subpaths", func() {
|
||||||
@ -4996,7 +4996,7 @@ spec:
|
|||||||
file, err := os.Create(filepath.Join(hostPathLocation, "testing", "onlythis", "123.txt"))
|
file, err := os.Create(filepath.Join(hostPathLocation, "testing", "onlythis", "123.txt"))
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
|
||||||
_, err = file.Write([]byte("hi"))
|
_, err = file.WriteString("hi")
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
|
|
||||||
err = file.Close()
|
err = file.Close()
|
||||||
|
@ -1058,9 +1058,9 @@ ENTRYPOINT ["sleep","99999"]
|
|||||||
data := inspectPod.InspectPodToJSON()
|
data := inspectPod.InspectPodToJSON()
|
||||||
|
|
||||||
inspect := podmanTest.InspectContainer(ctrCreate.OutputToString())
|
inspect := podmanTest.InspectContainer(ctrCreate.OutputToString())
|
||||||
Expect(data.CgroupPath).To(HaveLen(0))
|
Expect(data.CgroupPath).To(BeEmpty())
|
||||||
if podmanTest.CgroupManager == "cgroupfs" || !isRootless() {
|
if podmanTest.CgroupManager == "cgroupfs" || !isRootless() {
|
||||||
Expect(inspect[0].HostConfig.CgroupParent).To(HaveLen(0))
|
Expect(inspect[0].HostConfig.CgroupParent).To(BeEmpty())
|
||||||
} else if podmanTest.CgroupManager == "systemd" {
|
} else if podmanTest.CgroupManager == "systemd" {
|
||||||
Expect(inspect[0].HostConfig).To(HaveField("CgroupParent", "user.slice"))
|
Expect(inspect[0].HostConfig).To(HaveField("CgroupParent", "user.slice"))
|
||||||
}
|
}
|
||||||
|
@ -261,7 +261,7 @@ var _ = Describe("Podman prune", func() {
|
|||||||
session = podmanTest.Podman([]string{"network", "ls", "-q", "--filter", "name=^test$"})
|
session = podmanTest.Podman([]string{"network", "ls", "-q", "--filter", "name=^test$"})
|
||||||
session.WaitWithDefaultTimeout()
|
session.WaitWithDefaultTimeout()
|
||||||
Expect(session).Should(Exit(0))
|
Expect(session).Should(Exit(0))
|
||||||
Expect(session.OutputToStringArray()).To(HaveLen(0))
|
Expect(session.OutputToStringArray()).To(BeEmpty())
|
||||||
|
|
||||||
// Create new network.
|
// Create new network.
|
||||||
session = podmanTest.Podman([]string{"network", "create", "test1", "--label", "foo"})
|
session = podmanTest.Podman([]string{"network", "create", "test1", "--label", "foo"})
|
||||||
|
@ -324,7 +324,7 @@ var _ = Describe("Podman restart", func() {
|
|||||||
session1 = podmanTest.Podman([]string{"restart", "-a", "--filter", fmt.Sprintf("id=%swrongid", shortCid3)})
|
session1 = podmanTest.Podman([]string{"restart", "-a", "--filter", fmt.Sprintf("id=%swrongid", shortCid3)})
|
||||||
session1.WaitWithDefaultTimeout()
|
session1.WaitWithDefaultTimeout()
|
||||||
Expect(session1).Should(Exit(0))
|
Expect(session1).Should(Exit(0))
|
||||||
Expect(session1.OutputToString()).To(HaveLen(0))
|
Expect(session1.OutputToString()).To(BeEmpty())
|
||||||
|
|
||||||
session1 = podmanTest.Podman([]string{"restart", "-a", "--filter", fmt.Sprintf("id=%s", shortCid3)})
|
session1 = podmanTest.Podman([]string{"restart", "-a", "--filter", fmt.Sprintf("id=%s", shortCid3)})
|
||||||
session1.WaitWithDefaultTimeout()
|
session1.WaitWithDefaultTimeout()
|
||||||
|
@ -305,7 +305,7 @@ var _ = Describe("Podman rm", func() {
|
|||||||
session1 = podmanTest.Podman([]string{"rm", "-a", "-f", "--filter", fmt.Sprintf("id=%swrongid", shortCid3)})
|
session1 = podmanTest.Podman([]string{"rm", "-a", "-f", "--filter", fmt.Sprintf("id=%swrongid", shortCid3)})
|
||||||
session1.WaitWithDefaultTimeout()
|
session1.WaitWithDefaultTimeout()
|
||||||
Expect(session1).Should(Exit(0))
|
Expect(session1).Should(Exit(0))
|
||||||
Expect(session1.OutputToString()).To(HaveLen(0))
|
Expect(session1.OutputToString()).To(BeEmpty())
|
||||||
|
|
||||||
session1 = podmanTest.Podman([]string{"rm", "-a", "-f", "--filter", fmt.Sprintf("id=%s", shortCid3)})
|
session1 = podmanTest.Podman([]string{"rm", "-a", "-f", "--filter", fmt.Sprintf("id=%s", shortCid3)})
|
||||||
session1.WaitWithDefaultTimeout()
|
session1.WaitWithDefaultTimeout()
|
||||||
|
@ -145,7 +145,7 @@ var _ = Describe("Podman start", func() {
|
|||||||
wait.WaitWithDefaultTimeout()
|
wait.WaitWithDefaultTimeout()
|
||||||
Expect(wait).To(ExitWithError())
|
Expect(wait).To(ExitWithError())
|
||||||
|
|
||||||
Eventually(podmanTest.NumberOfContainers(), defaultWaitTimeout, 3.0).Should(BeZero())
|
Eventually(podmanTest.NumberOfContainers, defaultWaitTimeout, 3.0).Should(BeZero())
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman failed to start without --rm should NOT delete the container", func() {
|
It("podman failed to start without --rm should NOT delete the container", func() {
|
||||||
@ -157,7 +157,7 @@ var _ = Describe("Podman start", func() {
|
|||||||
start.WaitWithDefaultTimeout()
|
start.WaitWithDefaultTimeout()
|
||||||
Expect(start).To(ExitWithError())
|
Expect(start).To(ExitWithError())
|
||||||
|
|
||||||
Eventually(podmanTest.NumberOfContainers(), defaultWaitTimeout, 3.0).Should(Equal(1))
|
Eventually(podmanTest.NumberOfContainers, defaultWaitTimeout, 3.0).Should(Equal(1))
|
||||||
})
|
})
|
||||||
|
|
||||||
It("podman start --sig-proxy should not work without --attach", func() {
|
It("podman start --sig-proxy should not work without --attach", func() {
|
||||||
@ -216,12 +216,12 @@ var _ = Describe("Podman start", func() {
|
|||||||
session1 = podmanTest.Podman([]string{"start", cid1, "-f", "status=running"})
|
session1 = podmanTest.Podman([]string{"start", cid1, "-f", "status=running"})
|
||||||
session1.WaitWithDefaultTimeout()
|
session1.WaitWithDefaultTimeout()
|
||||||
Expect(session1).Should(Exit(0))
|
Expect(session1).Should(Exit(0))
|
||||||
Expect(session1.OutputToString()).To(HaveLen(0))
|
Expect(session1.OutputToString()).To(BeEmpty())
|
||||||
|
|
||||||
session1 = podmanTest.Podman([]string{"start", "--all", "--filter", fmt.Sprintf("id=%swrongid", shortCid3)})
|
session1 = podmanTest.Podman([]string{"start", "--all", "--filter", fmt.Sprintf("id=%swrongid", shortCid3)})
|
||||||
session1.WaitWithDefaultTimeout()
|
session1.WaitWithDefaultTimeout()
|
||||||
Expect(session1).Should(Exit(0))
|
Expect(session1).Should(Exit(0))
|
||||||
Expect(session1.OutputToString()).To(HaveLen(0))
|
Expect(session1.OutputToString()).To(BeEmpty())
|
||||||
|
|
||||||
session1 = podmanTest.Podman([]string{"start", "--all", "--filter", fmt.Sprintf("id=%s", shortCid3)})
|
session1 = podmanTest.Podman([]string{"start", "--all", "--filter", fmt.Sprintf("id=%s", shortCid3)})
|
||||||
session1.WaitWithDefaultTimeout()
|
session1.WaitWithDefaultTimeout()
|
||||||
|
@ -398,7 +398,7 @@ var _ = Describe("Podman stop", func() {
|
|||||||
session1 = podmanTest.Podman([]string{"stop", "-a", "--filter", fmt.Sprintf("id=%swrongid", shortCid3)})
|
session1 = podmanTest.Podman([]string{"stop", "-a", "--filter", fmt.Sprintf("id=%swrongid", shortCid3)})
|
||||||
session1.WaitWithDefaultTimeout()
|
session1.WaitWithDefaultTimeout()
|
||||||
Expect(session1).Should(Exit(0))
|
Expect(session1).Should(Exit(0))
|
||||||
Expect(session1.OutputToString()).To(HaveLen(0))
|
Expect(session1.OutputToString()).To(BeEmpty())
|
||||||
|
|
||||||
session1 = podmanTest.Podman([]string{"stop", "-a", "--filter", fmt.Sprintf("id=%s", shortCid3)})
|
session1 = podmanTest.Podman([]string{"stop", "-a", "--filter", fmt.Sprintf("id=%s", shortCid3)})
|
||||||
session1.WaitWithDefaultTimeout()
|
session1.WaitWithDefaultTimeout()
|
||||||
|
@ -175,7 +175,7 @@ func moveUnderCgroup(cgroup, subtree string, processes []uint32) error {
|
|||||||
|
|
||||||
if len(processes) > 0 {
|
if len(processes) > 0 {
|
||||||
for _, pid := range processes {
|
for _, pid := range processes {
|
||||||
if _, err := f.Write([]byte(fmt.Sprintf("%d\n", pid))); err != nil {
|
if _, err := f.WriteString(fmt.Sprintf("%d\n", pid)); err != nil {
|
||||||
logrus.Debugf("Cannot move process %d to cgroup %q: %v", pid, newCgroup, err)
|
logrus.Debugf("Cannot move process %d to cgroup %q: %v", pid, newCgroup, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user