backdrop / backdrop-issues

Issue tracker for Backdrop core.
144 stars 40 forks source link

Improve tests speed by reusing setUp structure for each test #1835

Closed Gormartsen closed 8 years ago

Gormartsen commented 8 years ago

I am looking how to properly reuse setUp without creating conflict and have fresh setup for each test. Task could be assigned to me.

klonos commented 8 years ago

Just tried assigning the issue to you but the autocomplete field does not have you GitHub handle available (??).

klonos commented 8 years ago

backdrop-github-cannot_assing_issue_to_gor

Gormartsen commented 8 years ago

@klonos tnx. I assume it's because I am not a part of backdrop/backdrop-issue team

klonos commented 8 years ago

@Gormartsen you are absolutely right.

Gormartsen commented 8 years ago

Summary from PR:

As a result - tests are running almost 2x times faster.

klonos commented 8 years ago

As a result - tests are running almost 2x times faster.

That's all we need to know. Yay!! Thanx @Gormartsen :clap:

quicksketch commented 8 years ago

This is awesome @Gormartsen! Test time is indeed cut in half. Great job!

I filed a new PR at https://github.com/backdrop/backdrop/pull/1366 that does a bit of clean up on the BackdropWebTestCase class. I made a change to it to use $this->fileDirectoryName in prepareEnvironment() so that we don't need to override that same method in your new class. I also did some clean up on the class that I'd been wanted to do for a while, fixing all the PHP inspections in PHPStorm.

Tests seem to be passing. I'll merge in the new version shortly.

quicksketch commented 8 years ago

Merged in https://github.com/backdrop/backdrop/pull/1366. We have a random fail happening pretty frequently. I've picked back up at https://github.com/backdrop/backdrop-issues/issues/1478#issuecomment-218927947 to fix that issue.

LionsAd commented 8 years ago

@Gormartsen This is a really awesome patch! Congratulations!

The idea not to use a DUMP, but instead to CREATE table LIKE X and INSERT INTO is great!

Gormartsen commented 8 years ago

@quicksketch thank you for cleaning code.

@LionsAd create table is still slow even on SSD disks. If you noticed, I added ALTER table to cache prepare phaze . MyISAM is faster for drop create table. A huge performance boost are coming from moving MySQL data dir to memory. (Like /dev/shm)