Browse Source

Improved ConnectionTest performance

Methods testMastersShuffled and testMastersSequential executed about 30 seconds each.
This commit reduces execution time to 2-5 seconds each.
tags/2.0.13
SilverFire - Dmitry Naumenko 7 years ago
parent
commit
06d7a1f0c6
No known key found for this signature in database
GPG Key ID: 39DD917A92B270A
  1. 6
      tests/framework/db/sqlite/ConnectionTest.php

6
tests/framework/db/sqlite/ConnectionTest.php

@ -117,6 +117,9 @@ class ConnectionTest extends \yiiunit\framework\db\ConnectionTest
$hit_slaves[$db->getSlave()->dsn] = true;
$hit_masters[$db->getMaster()->dsn] = true;
if (count($hit_slaves) === $slavesCount && count($hit_masters) === $mastersCount) {
break;
}
}
$this->assertCount($mastersCount, $hit_masters, 'all masters hit');
@ -139,6 +142,9 @@ class ConnectionTest extends \yiiunit\framework\db\ConnectionTest
$hit_slaves[$db->getSlave()->dsn] = true;
$hit_masters[$db->getMaster()->dsn] = true;
if (count($hit_slaves) === $slavesCount) {
break;
}
}
$this->assertCount(1, $hit_masters, 'same master hit');

Loading…
Cancel
Save