Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ before_script:
echo "xdebug.ini does not exist"
fi
- ./ci/prepare.sh
- ./ci/add-test-certs.sh

script:
- cd "$TRAVIS_BUILD_DIR/../easyengine"
Expand Down
106 changes: 0 additions & 106 deletions ci/add-test-certs.sh

This file was deleted.

30 changes: 30 additions & 0 deletions features/bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,9 @@ public static function cleanup(AfterFeatureScope $scope)
'www.example3.test',
'labels.test',
'wpcache.test',
'wp-local-db.test',
'wp-local-redis.test',
'wp-local-db-redis.test'
];

$result = EE::launch( 'sudo bin/ee site list --format=text',false, true );
Expand All @@ -422,4 +425,31 @@ public static function cleanup(AfterFeatureScope $scope)
unlink('ee-old.phar');
}
}

/**
* @Then Check global redis cache for :site
*/
public function checkGlobalRedisCacheOfSite($site)
{
exec("docker exec -it ee-global-redis redis-cli set 'easyengine' 'rock'");
$output = exec("docker exec -it ee-global-redis redis-cli get 'easyengine'");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also add checks for object cache working using: wp cache set and wp cache get
In both local and global scenario.

if ( '"rock"' !== $output ) {
throw new Exception("Global redis not working for $site site. Getting '$output' instead of 'rock'");
}
exec("docker exec -it ee-global-redis redis-cli del 'easyengine'");
}

/**
* @Then Check local redis cache for :site
*/
public function checkLocalRedisCacheOfSite($site)
{
$site_root_folder = EE_SITE_ROOT . '/' . $site;
exec("cd $site_root_folder && docker-compose exec redis redis-cli set 'easyengine' 'rock'");
$output = exec("cd $site_root_folder && docker-compose exec redis redis-cli get 'easyengine'");
if ( '"rock"' !== $output ) {
throw new Exception("Local redis not working for $site site. Getting '$output' instead of 'rock'.");
}
exec("cd $site_root_folder && docker-compose exec redis redis-cli del 'easyengine'");
}
}
137 changes: 135 additions & 2 deletions features/site.feature
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ Feature: Site Command
usage: ee site
"""

Scenario: Check site create sub command is present
When I run 'bin/ee site create'
Then STDOUT should return exactly
"""
usage: ee site create <site-name> [--ssl=<value>] [--wildcard] [--type=<type>] [--skip-status-check]
"""

Scenario: Create wp site successfully
When I run 'bin/ee site create wp.test --type=wp'
Then After delay of 5 seconds
Expand All @@ -26,15 +33,15 @@ Feature: Site Command
| header |
| HTTP/1.1 200 OK |

Scenario: Create wp site successfully
Scenario: Create wp cache site successfully
When I run 'bin/ee site create wpcache.test --type=wp --cache'
Then After delay of 5 seconds
And The site 'wpcache.test' should have webroot
And The site 'wpcache.test' should have WordPress
And Request on 'wpcache.test' should contain following headers:
| header |
| HTTP/1.1 200 OK |

Scenario: Create wpsubdir site successfully
When I run 'bin/ee site create wpsubdir.test --type=wp --mu=subdir'
And I create subsite '1' in 'wpsubdir.test'
Expand Down Expand Up @@ -67,6 +74,102 @@ Feature: Site Command
wpsubdom.test
"""

Scenario: Check site disable sub command is present
When I run 'bin/ee site disable'
Then STDERR should return something like
"""
Error: Could not find the site you wish to run site disable command on.
Either pass it as an argument: `ee site disable <site-name>`
or run `ee site disable` from inside the site folder.
"""

Scenario: Disable the site
When I run 'bin/ee site disable wp.test'
Then STDOUT should return exactly
"""
Disabling site wp.test.
Success: Site wp.test disabled.
"""
And Request on 'wp.test' should contain following headers:
| header |
| HTTP/1.1 503 Service Temporarily Unavailable |

Scenario: Check site reload sub command is present
When I run 'bin/ee site reload'
Then STDERR should return something like
"""
Error: Could not find the site you wish to run site reload command on.
Either pass it as an argument: `ee site reload <site-name>`
or run `ee site reload` from inside the site folder.
"""

Scenario: Reload site services
When I run 'bin/ee site reload wp.test'
Then STDERR should return something like
"""
Error: Site wp.test is not enabled. Use `ee site enable wp.test` to enable it.
"""

Scenario: Check site enable sub command is present
When I run 'bin/ee site enable'
Then STDERR should return something like
"""
Error: Could not find the site you wish to run site enable command on.
Either pass it as an argument: `ee site enable <site-name>`
or run `ee site enable` from inside the site folder.
"""

Scenario: Enable the site
When I run 'bin/ee site enable wp.test'
Then STDOUT should return exactly
"""
Enabling site wp.test.
Success: Site wp.test enabled.
Running post enable configurations.
Starting site's services.
Success: Post enable configurations complete.
"""
And Request on 'wp.test' should contain following headers:
| header |
| HTTP/1.1 200 OK |

Scenario: Check site info sub command is present
When I run 'bin/ee site info'
Then STDERR should return something like
"""
Error: Could not find the site you wish to run site info command on.
Either pass it as an argument: `ee site info <site-name>`
or run `ee site info` from inside the site folder.
"""

Scenario: Details of the site uing site info command
When I run 'bin/ee site info wp.test'
Then STDOUT should return something like
"""
| Site | http://wp.test
"""

Scenario: Reload site services
When I run 'bin/ee site reload wp.test'
Then STDOUT should return something like
"""
Reloading nginx
"""

Scenario: Reload site nginx services
When I run 'bin/ee site reload wp.test --nginx'
Then STDOUT should return something like
"""
Reloading nginx
"""

Scenario: Check site delete sub command is present
When I run 'bin/ee site delete'
Then STDOUT should return exactly
"""
usage: ee site delete <site-name> [--yes]
"""

Scenario: Delete the sites
When I run 'bin/ee site delete wp.test --yes'
Then STDOUT should return something like
Expand All @@ -85,3 +188,33 @@ Feature: Site Command
| db |
| redis |
| phpmyadmin |

Scenario: Create WordPress site with local DB and global redis
When I run 'bin/ee site create wp-local-db.test --cache --type=wp --local-db'
Then After delay of 5 seconds
And The site 'wp-local-db.test' should have webroot
And The site 'wp-local-db.test' should have WordPress
And Request on 'wp-local-db.test' should contain following headers:
| header |
| HTTP/1.1 200 OK |
And Check global redis cache for 'wp-local-db.test'

Scenario: Create WordPress site with local redis and global db
When I run 'bin/ee site create wp-local-redis.test --cache --type=wp --with-local-redis'
Then After delay of 5 seconds
And The site 'wp-local-redis.test' should have webroot
And The site 'wp-local-redis.test' should have WordPress
And Request on 'wp-local-redis.test' should contain following headers:
| header |
| HTTP/1.1 200 OK |
And Check local redis cache for 'wp-local-redis.test'

Scenario: Create WordPress site with local DB and local redis
When I run 'bin/ee site create wp-local-db-redis.test --cache --type=wp --local-db --with-local-redis'
Then After delay of 5 seconds
And The site 'wp-local-db-redis.test' should have webroot
And The site 'wp-local-db-redis.test' should have WordPress
And Request on 'wp-local-db-redis.test' should contain following headers:
| header |
| HTTP/1.1 200 OK |
And Check local redis cache for 'wp-local-db-redis.test'