mirror of
https://github.com/containers/podman.git
synced 2025-08-06 11:32:07 +08:00
Fix rand.Seed() deprecation in golang 1.20
Ref: https://pkg.go.dev/math/rand@go1.20#Seed Note: For `runtime_test.go`, this test-case was never actually doing what appears as it's intent . Fixing it to work as intended would be require incredibly libpod-invasive changes. Do the least-worse thing and simply confirm that consecutive generated names are different. Signed-off-by: Chris Evich <cevich@redhat.com>
This commit is contained in:
@ -1,7 +1,6 @@
|
||||
package libpod
|
||||
|
||||
import (
|
||||
"math/rand"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
@ -19,10 +18,8 @@ func Test_generateName(t *testing.T) {
|
||||
}
|
||||
|
||||
// Test that (*Runtime).generateName returns different names
|
||||
// if called twice, even if the global RNG has the default
|
||||
// seed.
|
||||
// if called twice.
|
||||
n1, _ := r.generateName()
|
||||
rand.Seed(1)
|
||||
n2, _ := r.generateName()
|
||||
assert.NotEqual(t, n1, n2)
|
||||
}
|
||||
|
Reference in New Issue
Block a user