Commit 6ce002e1 authored by helmo's avatar helmo

Satisfy coder module

parent 7ba6176a
<?php
/**
* @file
* Some tests for hostmaster and provison.
* Some tests for hostmaster and provison.
*
* These could live in Hostmaster or Provision, and there are advantages and
* disadvantages to both. But I decided that I'd just get on with it and pop
* them into Provision.
* These could live in Hostmaster or Provision, and there are advantages and
* disadvantages to both. But I decided that I'd just get on with it and pop
* them into Provision.
*/
define('PROVISION_TESTS_BUILDS_REPO', dirname(__FILE__) . '/makes');
......@@ -13,14 +13,14 @@ define('PROVISION_TESTS_DEFAULT_LOCK_WAIT', 60);
define('PROVISION_TESTS_LOCK_TIMEOUT', 3600.0);
/**
* Implementation of hook_drush_command().
* Implements hook_drush_command().
*/
function provision_tests_drush_command() {
$items['provision-tests-run'] = array(
'description' => dt('Runs provision tests'),
'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_FULL,
// Although we're a provision command, we require hostmaster to be around to
// run the tests correctly
// run the tests correctly.
'drupal dependencies' => array(
'hosting',
),
......@@ -33,7 +33,7 @@ function provision_tests_drush_command() {
'description' => dt('Runs NEW provision tests'),
'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_FULL,
// Although we're a provision command, we require hostmaster to be around to
// run the tests correctly
// run the tests correctly.
'drupal dependencies' => array(
'hosting',
),
......@@ -46,7 +46,7 @@ function provision_tests_drush_command() {
'description' => dt('Setup some demo content on a fresh Aegir install'),
'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_FULL,
// Although we're a provision command, we require hostmaster to be around to
// run the tests correctly
// run the tests correctly.
'drupal dependencies' => array(
'hosting',
),
......@@ -114,7 +114,7 @@ function drush_provision_tests_run() {
drush_provision_tests_remove_site('drupal7-migrate-drupal7-other');
drush_provision_tests_remove_platform('drupal7_other');
// Create some sites, and upgrade them
// Create some sites, and upgrade them.
drush_provision_tests_install_site('drupal6', 'drupal6-upgrade-drupal7', 'default');
drush_provision_tests_migrate_site('drupal6-upgrade-drupal7', 'drupal7');
drush_provision_tests_remove_site('drupal6-upgrade-drupal7');
......@@ -123,7 +123,7 @@ function drush_provision_tests_run() {
drush_provision_tests_remove_platform('drupal6');
drush_provision_tests_remove_platform('drupal7');
// Restore the tasks queue status:
// Restore the tasks queue status.
variable_set('hosting_queue_tasks_enabled', $queue_status_initial);
drush_log(dt('Releasing lock on task queue.'));
lock_release('hosting_queue_tasks_running');
......@@ -267,7 +267,7 @@ function drush_provision_tests_install_platform($platform_name, $platform_alias
drush_log(dt('Building platform: @platform and adding to hostmaster.', array('@platform' => $platform_alias)), 'ok');
$args = array(
PROVISION_TESTS_BUILDS_REPO . "/$platform_name.make",
"/var/aegir/platforms/$platform_alias"
"/var/aegir/platforms/$platform_alias",
);
$opts = array();
if (version_compare(drush_core_version(), '7', '>=')) {
......@@ -282,7 +282,7 @@ function drush_provision_tests_install_platform($platform_name, $platform_alias
'context_type' => 'platform',
);
drush_invoke_process('@none', 'provision-save', $args, $options);
provision_backend_invoke('@hostmaster', 'hosting-import', array("@platform_$platform_alias",));
provision_backend_invoke('@hostmaster', 'hosting-import', array("@platform_$platform_alias"));
drush_provision_tests_run_remaining_tasks();
}
......@@ -371,21 +371,21 @@ function drush_provision_tests_remove_site($site) {
/**
* Migrates a site from one platform to another.
*
* @param $site
* @param string $site
* The site to migrate.
* @param $target
* @param string $target
* The target platform to migrate to.
*/
function drush_provision_tests_migrate_site($site, $target) {
drush_log(dt('Migrating: @site to platform: @platform.', array('@site' => "$site.aegir.example.com", '@platform' => $target)), 'ok');
// Do the migrate.
provision_backend_invoke("@$site.aegir.example.com", 'provision-migrate', array("@platform_$target",));
provision_backend_invoke("@$site.aegir.example.com", 'provision-migrate', array("@platform_$target"));
// Import the site into the frontend.
provision_backend_invoke('@hostmaster', 'hosting-import', array("@$site.aegir.example.com",));
provision_backend_invoke('@hostmaster', 'hosting-import', array("@$site.aegir.example.com"));
// Verify the $target platform.
provision_backend_invoke('@hostmaster', 'hosting-task', array("@platform_$target", 'verify'), array('force' => TRUE));
// Import and verify the site.
provision_backend_invoke('@hostmaster', 'hosting-import', array("@$site.aegir.example.com",));
provision_backend_invoke('@hostmaster', 'hosting-import', array("@$site.aegir.example.com"));
provision_backend_invoke('@hostmaster', 'hosting-task', array("@$site.aegir.example.com", 'verify'), array('force' => TRUE));
drush_provision_tests_run_remaining_tasks();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment