Page MenuHomePhabricator

Continuous integration - CiviCRM
Closed, ResolvedPublic0 Estimated Story Points

Description

CiviCRM recently did some work for us to help build a better testing infrastructure within Civi. We're confident this can speed up development and make our changes more robust, and just need to finish the work out.

This is blocking many Q3 projects, since we want the testing to help us do a CiviCRM release upgrade safely.

Requirements

  • PHPUnit tests available for every input queue pipeline, using bundled test fixture data.
  • Manually process any message type from drush, using a test fixture or other file
  • Do not connect to the queue server.
  • Do not require Drush or Simpletest, tests can be run by phpunit directly.

It would be a huge bonus if we could do without MySQL. The blocker here is that Civi does not support any other SQL syntax.

Implementation

A phpunit.xml configuration file in the project's root directory will specify a bootstrap file in sites/default, which defines the DRUPAL_ROOT directory and makes the base wmf_common PHPUnit test case class available. Drupal bootstrapping is done with minimal code, without dependencies on Drush or Simpletest.

Self-contained unit tests may inherit PHPUnit_Framework_TestCase, but tests that need Drupal or database functionality should inherit from BaseWmfDrupalPhpUnitTestCase.

Drush single-message processing can be done using the new commands dpm, rpm, and rfdpm. The command will take a single argument, the path to a json file containing the message contents. See example messages in queue2civicrm/tests/data.

TODO

  • cmdline option to drush jobs to synthesize or specify a new gateway_txn_id, to override the fixture data and prevent duplicate errors. We could eventually use this sort of instrumentation to trickle test transactions through our system and continually test it.
  • I've probably trashed the existing SimpleTest-based cases. Refactor them to run under PHPUnit.

Related Objects

Event Timeline

atgo raised the priority of this task from to Needs Triage.
atgo updated the task description. (Show Details)
atgo added a project: Fundraising-Backlog.
atgo changed Security from none to None.
atgo subscribed.

Change 194915 had a related patch set uploaded (by Awight):
Move integration scripts into this repo

https://gerrit.wikimedia.org/r/194915

Change 194915 merged by Ejegg:
Move integration scripts into this repo

https://gerrit.wikimedia.org/r/194915

Change 194998 had a related patch set uploaded (by Awight):
WIP download stuff before running it

https://gerrit.wikimedia.org/r/194998

Change 195010 had a related patch set uploaded (by Awight):
Don't pushd to crazy directory to run drush

https://gerrit.wikimedia.org/r/195010

Change 195011 had a related patch set uploaded (by Awight):
Ignore vendor

https://gerrit.wikimedia.org/r/195011

Change 195010 merged by Ejegg:
pushd to less crazy directory before running drush

https://gerrit.wikimedia.org/r/195010

Change 194998 merged by Ejegg:
Download stuff before running it.

https://gerrit.wikimedia.org/r/194998

awight claimed this task.
awight moved this task from AWight brooding on to Backlog on the Fundraising-Backlog-Old board.