Help D7 SimpleTest maintainer and usablity expert get to Drupalcon Paris 2009

The scholarships provided by the Drupalcon Paris team will not cover all the accommodation expenses. Bojhan and myself (boombatower) have decided to stay together and share the expenses. In order to make it to Paris we need to raise at least $500 USD, otherwise I will not be attending.

Take a look at our user pages to get an idea of the work we have done for Drupal.

I plan to give two sessions: Introduction to testing with Drupal: SimpleTest and Sept 2nd, Drupal 7 release party. How continuous integration testing made this plausible.

Bojhan has two presentation proposals as well: Building blocks for your module's UI and How Open Design will drive Drupal 8.

We appreciate your donations and hope to accomplish much at Drupalcon Paris.

Update restore pattern

Recently I have been working on confirming that the Project Issue File Review (PIFR) and Project Issue File Testing (PIFT) update paths from 1.x to 2.x work properly. I was attempting to do so with a copy of the live data from testing.drupal.org and drupal.org. Doing so would ensure that the somewhat delicate upgrade path functioned properly.

I ran into the issue of resetting the data after a failed update attempt. Doing so is not a quick and simple task, especially for the PIFR upgrade which requires renaming the old tables (I may move into udpate path itself) so the data can be converted and placed in the new schema. To solve the problem I developed the following script, or pattern, that can be used to reset for another update attempt. The first script is the one used for the PIFT update which is much simpler. The pift_data.sql contains the live data from drupal.org and similar with the PIFR update.

I placed the scripts in index.php, just as I do with all my scripts, after the <?php drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); ?> line. The scripts can then be ivoked by appending ?restore=true to the URL to your site. Obviously I commented out the one I was not using.

I found that having these scripts helped ensure that I tested the update path extensively and as such they seem like a good thing to share.

PIFT update reset script

<?php
if (isset($_GET['restore'])) {
  
header('Content-Type: text/plain');
  
ini_set('display_errors'1);
  
set_time_limit(0);

  echo 
"resetting...\n";

  
db_query('TRUNCATE TABLE {watchdog}');

  
db_query("UPDATE {system}
            SET schema_version = %d
            WHERE name = '%s'"
6000'pift');

  
$tables = array(
    
'pift_data',
    
'pift_test',
    
'pift_project',
  );
  
$ret = array();
  foreach (
$tables as $table) {
    if (
db_table_exists($table)) {
      
db_drop_table($ret$table);
    }
  }

  echo 
"importing d.o dataset...\n";

  
$parts parse_url($db_url['default']);
  
$command "mysql -u{$parts['user']} -p{$parts['pass']} " substr($parts['path'], 1);
  
exec($command ' < /home/boombatower/download/pift_data.sql');

  echo 
"finished...\n";

  
print_r($ret);

  exit;
}
?>

PIFR update reset script

<?php
if (isset($_GET['restore'])) {
  
header('Content-Type: text/plain');
  
ini_set('display_errors'1);
  
set_time_limit(0);

  echo 
"resetting...\n";

  
db_query('TRUNCATE TABLE {watchdog}');

  
db_query("UPDATE {system}
            SET schema_version = %d
            WHERE name = '%s'"
6000'pifr');

  
$tables = array(
    
'pifr_branch',
    
'pifr_client',
    
'pifr_file',
    
'pifr_log',
    
'pifr_project',
    
'pifr_result',
    
'pifr_result_detail',
    
'pifr_result_detail_assertion',
    
'pifr_test',
    
'pifr_file_old',
    
'pifr_result_old',
    
'pifr_server',
    
'pifr_log_old',
  );
  
$ret = array();
  foreach (
$tables as $table) {
    if (
db_table_exists($table)) {
      
db_drop_table($ret$table);
    }
  }

  echo 
"importing t.d.o dataset...\n";

  
$parts parse_url($db_url['default']);
  
$command "mysql -u{$parts['user']} -p{$parts['pass']} " substr($parts['path'], 1);
  
exec($command ' < /home/boombatower/download/tdo.sql');

  echo 
"renaming...\n";

  
db_rename_table($ret'pifr_file''pifr_file_old');
  
db_rename_table($ret'pifr_result''pifr_result_old');
  
db_rename_table($ret'pifr_log''pifr_log_old');

  echo 
"importing pifr_server schema...\n";

  
exec($command ' < /home/boombatower/download/pifr_server.sql');

  echo 
"finished...\n";

  
print_r($ret);

  exit;
}
?>

Tags:

Firefox userContent.css for drupal.org issue queue

After seeing a reference to http://userstyles.org/styles/11133 by tha_sun in IRC I went ahead and played with it a bit. I ended up with a very simple version that that just removes the blocks and makes the issue table full width. While I was at it I customized Google.

If you do not know where to put this checkout, per-site custom CSS in Firefox.

@namespace url('http://www.w3.org/1999/xhtml');
 
@-moz-document url-prefix('http://drupal.org/project/issues/') {
  #spacer {}
 
  #contentwrapper {
    background: none !important;
  }
 
  #main {
    margin-left: 5px;
    margin-right: 5px;
  }
 
  #threecol, #content, #squeeze {
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }
 
  .sidebar .block {
    display: none !important;
  }
}
 
@-moz-document url('http://www.google.com/') {
  #spacer {}
 
  #ghead, td[align='left'], td[width='25%'], #body > center > font, input[name='btnG'], input[name='btnI'], #footer {
    display: none;
  }
 
  #main > center {
    margin-top: 250px;
  }
}

Acquia internship

Acquia logo

This Summer I will be working part-time as an intern for Acquia. I am very excited to be working with Acquia and having the chance to spend more time improving things that I have interest in. To clarify I will be working on projects that benefit the entire Drupal community. The items I will be working on are improvements to projects I have either started or that I am heavily involved with.

During the discussion of the internship I came up with the following goals that were then prioritized by Dries.

Primary goals

  • Finalize testing of contributed modules and Drupal 6.x projects/core.
  • Add executive summary of test results on project page.
  • Extend the SimpleTest framework so we can test the installer and update/upgrade system.
  • Improve and organize SimpleTest documentation
  • Work on general enhancement of Drupal 7 SimpleTest.

Secondary goals

  • Provide on-demand patch testing environment for human review of patches.
  • Finish refactoring of SimpleTest to allow for a clean implementation of "configuration" testing.
  • Analyze current test quality and code coverage, and foster work in areas requiring attention.

I will post updates on some of the more interesting items as they are accomplished. Additionally, I would like to give a special thanks to Kieran Lal for his mentoring and help in finding me sponsorship.

FOLLOW UP:
To clarify I will still be participating in Google Summer of Code 2009, which was explicit in my agreement with Acquia.
Follow up post by Dries.

Automated Testing System - Statistics

I decided to pull gather some statistics about the automated testing system. These statistics were collected on Wednesday, May 6, 2009 at 4:00 AM GMT. Automatic generation of these statistics along with analysis is a feature I have in mind for ATS 2.0. I appreciate donations to the chipin (right), as this project requires a lot of development time.

From the data you can see that the test slaves have been running tests for the equivalent of 200 days. The system has been running for 192 days and not all the data was included since some of it is inaccurate. That means the system has saved 200 days of developer's time! It is clear that the ATS is a vital part of test driven development. Additionally the time that would have been spent fixing regressions and new bugs has been drastically lowered.

Item Function Value
Time testing SUM 17,310,047 seconds (~288,500 minutes, ~200 days)
Test run (test suite) COUNT 42,351
MAX 3620 seconds (~60 minutes)
MIN 17 seconds
AVG 804 seconds (~ 13 minutes)
STDDEV_POP 783 seconds (~13 minutes)
Test (patch, times tested) COUNT 6,953
MAX 86
MIN 1
AVG 10
STDDEV_POP 15
Test pass count MAX 11,453
MIN 0
AVG 4,265
STDDEV_POP 4,910
Test fail count MAX 6,989
MIN 0
AVG 9
STDDEV_POP 155
Test exception count MAX 813,795
MIN 0
AVG 160
STDDEV_POP 9,893

One item you may notice is the maximum test exception count of 813,795. The patch that caused that many exceptions proved that our system is scalable! The patch is much appreciated. :)

Saved the current test result breakdown.

Result distribution

The average test run length for all the active test slaves can be seen below. This data is only looking at the latest test run for each patch in the system.

Test slave Average test length*
4 730 seconds
5 1,753 seconds
7 1,352 seconds
8 576 seconds
9 2,438 seconds
10 1,942 seconds
12 1,161 seconds
16 217 seconds

* Excludes test runs that do not pass initial checks and fail before running test suite.

Average Test Length

Automated Testing System 2.0 - New Features - Part 1

Over the next few weeks I plan to make a number of posts about the new features provided by ATS 2.0 and the benefits to the community. Currently, the system is in the final stages of deployment, but is not yet active. Please be aware that these features will be available once ATS 2.0 has been deployed. I appreciate donations to the chipin (right), as this project requires a lot of development time.

Server management

One of the major restraints holding back the expansion of the system has been the need to manually oversee the array of testing servers. The new system contains a number of enhancements to make it not only easier to manage the network, but also automates the task of adding new clients.

Client enable process
Upon request to enable client a set of error cases are sent to the client with expected results.

The most important addition that makes all this possible is the automatic client testing. Clients are automatically tested to ensure they are functioning properly. This is done through a set of tests that are sent to each test client with an expected result. The results the client sends back and compared with the expected result and that information is used to determine if the client is functioning properly. Clients are tested on a regular basis to ensure that they continue functioning as expected.

Another helpful change has been re-working the underlying architecture to use a pull based protocol instead of a push based protocol. This alleviates the issues caused when a client is unreachable for a period of time, or is removed without notice.

Public server queue

Add client
Very simple screen that allows users to add a test client to the network.

Another improvement that will facility a larger testing network is the public server queue. Allowing anyone to add a server to the network is possible since the clients are automatically tested as described above.

The interface has been designed so that users may control the set of machines that they have added to the network. The system automatically assigns the client a key that must be stored on the client and is used for authentication. The process of adding a client to the master list is very simple and should provide an easy way for users to donate servers.

If the system detects any issues with the client down the line, such as becoming out of date, it will notify the server administrator of the problem and disable the test client. The system will continually re-test the client and re-enable it automatically if it passes inspection. Alternatively, the server administrator may request the client to be tests immediately after fixing the issue.

Multiple database support

The new system has been abstracted to allow for the support of PostgreSQL and SQLite in addition to MySQL. This is vital to ensure that the Drupal 7 properly supports all three databases. Just as patches are not committed until they pass all the tests, patches will not be committed until after passing all the test on all three databases (5 environments with the database variations).

SimpleTest 6.x-2.8 - fresh backport

I maintain a backport of Drupal 7 SimpleTest for use with Drupal 6 as the SimpleTest module 2.x branch. A fair amount of work goes into maintaining the code even though it is a backport.

Tonight I finished up a fresh backport of Drupal 7 and made a release along with a number of other changes. Please update to SimpleTest 6.x-2.8 and report any issues you find.

Note to developers

Since this release includes a fresh backport it also contains an API change that you need to be aware of. All getInfo() methods need to be changed to static before using this release. If you are a module developer or maintain tests internally please make sure you update them.

Old

<?php
function getInfo() {
  return array(
    
'name' => t('[name]'),
    
'description' => t('[description]'),
    
'group' => t('[group]'),
  );
}
?>

New

<?php
public static function getInfo() {
  return array(
    
'name' => t('[name]'),
    
'description' => t('[description]'),
    
'group' => t('[group]'),
  );
}
?>

Automated Testing System 2.0 - Final Steps

During the last several months I put a substantial amount of work into improving the Automated Testing System. Future posts will describe the exciting new features and the benefits to the community. If interested, a brief overview of some of the requirements can be found in the PIFR and PIFT issue queues.

For additional background, the original thoughts can be found at the following links:

Final steps
There a number of steps that need to be completed before the Drupal community can reap the benefits of the new system.

  1. Security review of rewritten Project Issue File Test (PIFT) module that integrates with the project module on drupal.org.
  2. Someone familiar with SQLite, possibly one of the D7 maintainers, needs to write a PIFR DB driver to implement the required methods. MySQL and PostgresSQL have already been completed and can be used as examples. The driver is relatively simple, but will require manually connecting to SQLite since PIFR runs in D6 which does not support SQLite.
  3. Update testing client setup/installation script where necessary.
  4. Deploy current development system to project.drupal.org and the create a parallel testing client network.
  5. Freeze the current test client network and extract the test ID map for use in drupal.org upgrade.
  6. Upgrade and finalize test client network and test server (testing.drupal.org). Possibly move testing.drupal.org under the drupal.org infrastructure.
  7. Confirm upgraded testing network is functional.
  8. Plan for approximately 15 minutes of downtime on drupal.org.
  9. Update PIFT code and run data update using extracted test ID map from #4 on drupal.org during downtime.
  10. Watch deployed system closely and solicit community feedback and bug reports.
  11. Request additional hardware to use as community test clients (to allow for future expansion into testing contributed modules).

Future
Once the second generation framework is in place and running smoothly I will begin work on finishing the last pieces required to allow for testing of contributed modules (D6 and D7) and Drupal 6 core. I will be writing more on the new features and UX improvements to be looking for in during the upcoming deployment.

Pages

Subscribe to boombatower RSS