Re: [Postfixadmin-devel] xmlrpc.php, tests/* and some possible bugs
Brought to you by:
christian_boltz,
gingerdog
From: Christian B. <pos...@cb...> - 2009-04-12 00:36:52
|
Hello, Am Samstag, 11. April 2009 schrieb Christian Boltz: > [several possible bugs] I commited the fixes as discussed on IRC. When I now run tests/run.php, I _sometimes_ get 1 failure. Postfixadmin XMLRPC Unit Tests 1) at [/home/cb/postfixadmin/HEAD/tests/RemoteAliasTest.php line 44] in testUpdateRemoteOnly in RemoteAliasTest in ./RemoteAliasTest.php FAILURES!!! Test cases run: 4/4, Passes: 26, Failures: 1, Exceptions: 0 Some testing shows that it might be a race condition. Adding a sleep(1) to RemoteAliasTest.php (see patch below) fixes the problem and the testcases work without a failure. Do you have any idea what could cause the race condition in this specific test? --- RemoteAliasTest.php (Revision 626) +++ RemoteAliasTest.php (Arbeitskopie) @@ -41,7 +41,7 @@ public function testUpdateRemoteOnly() { $this->assertTrue($this->alias->update(array('ro...@ra...'), 'remote_only')); $this->assertFalse($this->alias->hasStoreAndForward()); - $this->assertTrue($this->alias->update(array('ro...@ra...'), 'remote_only')); + sleep(1); $this->assertTrue($this->alias->update(array('ro...@ra...'), 'remote_only')); $this->assertTrue($this->alias->update(array('ro...@ra...', 'fi...@fi...', 'ro...@ru...'), 'remote_only')); $this->assertEqual($this->alias->get(), array('ro...@ra...', 'fi...@fi...', 'ro...@ru...')); $this->assertFalse($this->alias->hasStoreAndForward()); Regarding error_reporting: > IMHO run.php should ini_set() it to be really sure we catch all > undefined variables etc. which won't cause noticable errors ("just" > strange bugs) otherwise. Unfortunately setting error_reporting in tests/run.php doesn't help much. The reason is that the tests do http calls to xmlrpc.php, and therefore the setting in php.ini is used on the xmlrpc.php side... Another small issue: The tests should clean up the database after being run IMHO. (Or at least use a random password for the mailbox created by the tests to avoid abuse if someone runs the tests on a public server.) Regards, Christian Boltz -- Das ist die Goldene Regel für das Performancetuning von UNIX-Systemen: RAM ist nur durch mehr RAM zu ersetzen. [Kristian Koehntopp in suse-linux] |