From c2c45d77691d1ca501a68d20885d040415477c92 Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Wed, 8 Apr 2015 18:13:07 -0700 Subject: [PATCH] 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 --- daemon/execdriver/lxc/lxc_template_unit_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/daemon/execdriver/lxc/lxc_template_unit_test.go b/daemon/execdriver/lxc/lxc_template_unit_test.go index 78760f6007..fcac6a3e57 100644 --- a/daemon/execdriver/lxc/lxc_template_unit_test.go +++ b/daemon/execdriver/lxc/lxc_template_unit_test.go @@ -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)