mirror of
https://github.com/containers/podman.git
synced 2025-05-21 00:56:36 +08:00

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>
26 lines
442 B
Go
26 lines
442 B
Go
package libpod
|
|
|
|
import (
|
|
"os"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func Test_generateName(t *testing.T) {
|
|
state, path, _, err := getEmptyBoltState()
|
|
assert.NoError(t, err)
|
|
defer os.RemoveAll(path)
|
|
defer state.Close()
|
|
|
|
r := &Runtime{
|
|
state: state,
|
|
}
|
|
|
|
// Test that (*Runtime).generateName returns different names
|
|
// if called twice.
|
|
n1, _ := r.generateName()
|
|
n2, _ := r.generateName()
|
|
assert.NotEqual(t, n1, n2)
|
|
}
|