From f57e54491926aa3bf2653a3c2b088b00a878edac Mon Sep 17 00:00:00 2001 From: Brian Bland Date: Wed, 10 Dec 2014 16:20:14 -0800 Subject: [PATCH] Increases stress test factor of TestConcurrentFileStreams Also makes this test respect the Short flag, reducing the number of threads by a factor of 4 and space usage by a factor of 16 Note: this test is probably unreasonable to run on the inmemory driver without the Short flag --- storagedriver/testsuites/testsuites.go | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/storagedriver/testsuites/testsuites.go b/storagedriver/testsuites/testsuites.go index b568a9c8..16c8cd0e 100644 --- a/storagedriver/testsuites/testsuites.go +++ b/storagedriver/testsuites/testsuites.go @@ -696,6 +696,13 @@ func (suite *DriverSuite) TestConcurrentFileStreams(c *check.C) { // c.Skip("Need to fix out-of-process concurrency") // } + numStreams := 32 + + if testing.Short() { + numStreams = 8 + c.Log("Reducing number of streams to 8 for short mode") + } + var wg sync.WaitGroup testStream := func(size int64) { @@ -703,13 +710,10 @@ func (suite *DriverSuite) TestConcurrentFileStreams(c *check.C) { suite.testFileStreams(c, size) } - wg.Add(6) - go testStream(8 * 1024 * 1024) - go testStream(4 * 1024 * 1024) - go testStream(2 * 1024 * 1024) - go testStream(1024 * 1024) - go testStream(1024) - go testStream(64) + wg.Add(numStreams) + for i := numStreams; i > 0; i-- { + go testStream(int64(numStreams) * 1024 * 1024) + } wg.Wait() } @@ -718,6 +722,7 @@ func (suite *DriverSuite) testFileStreams(c *check.C, size int64) { tf, err := ioutil.TempFile("", "tf") c.Assert(err, check.IsNil) defer os.Remove(tf.Name()) + defer tf.Close() filename := randomPath(32) defer suite.StorageDriver.Delete(firstPart(filename))