summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd/podman/networks/list.go6
-rw-r--r--go.mod2
-rw-r--r--go.sum3
-rw-r--r--test/system/500-networking.bats15
-rw-r--r--utils/utils.go6
-rw-r--r--vendor/modules.txt2
6 files changed, 29 insertions, 5 deletions
diff --git a/cmd/podman/networks/list.go b/cmd/podman/networks/list.go
index 6f1a7742a..7ce566225 100644
--- a/cmd/podman/networks/list.go
+++ b/cmd/podman/networks/list.go
@@ -3,6 +3,7 @@ package network
import (
"fmt"
"os"
+ "sort"
"strings"
"github.com/containers/common/pkg/completion"
@@ -73,6 +74,11 @@ func networkList(cmd *cobra.Command, args []string) error {
return err
}
+ // sort the networks to make sure the order is deterministic
+ sort.Slice(responses, func(i, j int) bool {
+ return responses[i].Name < responses[j].Name
+ })
+
switch {
// quiet means we only print the network names
case networkListOptions.Quiet:
diff --git a/go.mod b/go.mod
index e2106eaaf..de320b894 100644
--- a/go.mod
+++ b/go.mod
@@ -24,7 +24,7 @@ require (
github.com/davecgh/go-spew v1.1.1
github.com/digitalocean/go-qemu v0.0.0-20210209191958-152a1535e49f
github.com/docker/distribution v2.7.1+incompatible
- github.com/docker/docker v20.10.11+incompatible
+ github.com/docker/docker v20.10.12+incompatible
github.com/docker/go-connections v0.4.0
github.com/docker/go-plugins-helpers v0.0.0-20200102110956-c9a8a2d92ccc
github.com/docker/go-units v0.4.0
diff --git a/go.sum b/go.sum
index 15b0b5a37..a0d779fdf 100644
--- a/go.sum
+++ b/go.sum
@@ -344,8 +344,9 @@ github.com/docker/distribution v2.7.1+incompatible h1:a5mlkVzth6W5A4fOsS3D2EO5BU
github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
github.com/docker/docker v1.4.2-0.20190924003213-a8608b5b67c7/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/docker v20.10.8+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
-github.com/docker/docker v20.10.11+incompatible h1:OqzI/g/W54LczvhnccGqniFoQghHx3pklbLuhfXpqGo=
github.com/docker/docker v20.10.11+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
+github.com/docker/docker v20.10.12+incompatible h1:CEeNmFM0QZIsJCZKMkZx0ZcahTiewkrgiwfYD+dfl1U=
+github.com/docker/docker v20.10.12+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/docker-credential-helpers v0.6.3/go.mod h1:WRaJzqw3CTB9bk10avuGsjVBZsD05qeibJ1/TYlvc0Y=
github.com/docker/docker-credential-helpers v0.6.4 h1:axCks+yV+2MR3/kZhAmy07yC56WZ2Pwu/fKWtKuZB0o=
github.com/docker/docker-credential-helpers v0.6.4/go.mod h1:ofX3UI0Gz1TteYBjtgs07O36Pyasyp66D2uKT7H8W1c=
diff --git a/test/system/500-networking.bats b/test/system/500-networking.bats
index deadfa90a..4d36163d7 100644
--- a/test/system/500-networking.bats
+++ b/test/system/500-networking.bats
@@ -16,6 +16,21 @@ load helpers
if [[ ${output} = ${heading} ]]; then
die "network ls --noheading did not remove heading: $output"
fi
+
+ # check deterministic list order
+ local net1=a-$(random_string 10)
+ local net2=b-$(random_string 10)
+ local net3=c-$(random_string 10)
+ run_podman network create $net1
+ run_podman network create $net2
+ run_podman network create $net3
+
+ run_podman network ls --quiet
+ # just check the the order of the created networks is correct
+ # we cannot do an exact match since developer and CI systems could contain more networks
+ is "$output" ".*$net1.*$net2.*$net3.*podman.*" "networks sorted alphabetically"
+
+ run_podman network rm $net1 $net2 $net3
}
# Copied from tsweeney's https://github.com/containers/podman/issues/4827
diff --git a/utils/utils.go b/utils/utils.go
index 095370a08..241e361cd 100644
--- a/utils/utils.go
+++ b/utils/utils.go
@@ -11,6 +11,7 @@ import (
"strconv"
"strings"
"sync"
+ "time"
"github.com/containers/common/pkg/cgroups"
"github.com/containers/podman/v3/libpod/define"
@@ -204,8 +205,9 @@ func moveProcessToScope(pidPath, slice, scope string) error {
func MovePauseProcessToScope(pausePidPath string) {
var err error
- for i := 0; i < 3; i++ {
- r := rand.Int()
+ state := rand.New(rand.NewSource(time.Now().UnixNano()))
+ for i := 0; i < 10; i++ {
+ r := state.Int()
err = moveProcessToScope(pausePidPath, "user.slice", fmt.Sprintf("podman-pause-%d.scope", r))
if err == nil {
return
diff --git a/vendor/modules.txt b/vendor/modules.txt
index 3109a6698..1976528fe 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -311,7 +311,7 @@ github.com/docker/distribution/registry/client/auth/challenge
github.com/docker/distribution/registry/client/transport
github.com/docker/distribution/registry/storage/cache
github.com/docker/distribution/registry/storage/cache/memory
-# github.com/docker/docker v20.10.11+incompatible
+# github.com/docker/docker v20.10.12+incompatible
## explicit
github.com/docker/docker/api
github.com/docker/docker/api/types