1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

execdriver/lxc: use local rand.Random in test

Preventing the test execution to pollute the deterministic runtime environment
by seeding the global rand.Random.

Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
This commit is contained in:
Ahmet Alp Balkan 2015-04-08 18:13:07 -07:00
parent 7233bd223d
commit c2c45d7769

View file

@ -29,14 +29,14 @@ func TestLXCConfig(t *testing.T) {
os.MkdirAll(path.Join(root, "containers", "1"), 0777)
// Memory is allocated randomly for testing
rand.Seed(time.Now().UTC().UnixNano())
r := rand.New(rand.NewSource(time.Now().UTC().UnixNano()))
var (
memMin = 33554432
memMax = 536870912
mem = memMin + rand.Intn(memMax-memMin)
mem = memMin + r.Intn(memMax-memMin)
cpuMin = 100
cpuMax = 10000
cpu = cpuMin + rand.Intn(cpuMax-cpuMin)
cpu = cpuMin + r.Intn(cpuMax-cpuMin)
)
driver, err := NewDriver(root, root, "", false)