Skip to content

Commit cb65409

Browse files
committed
Add remote DB behat test
1 parent a4e6b1f commit cb65409

3 files changed

Lines changed: 34 additions & 8 deletions

File tree

.travis.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,6 @@ addons:
3838
apt:
3939
packages:
4040
- docker-ce
41+
42+
services:
43+
- mysql

features/bootstrap/FeatureContext.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,9 @@ public static function cleanup(AfterFeatureScope $scope)
407407
'wpcache.test',
408408
'wp-local-db.test',
409409
'wp-local-redis.test',
410-
'wp-local-db-redis.test'
410+
'wp-local-db-redis.test',
411+
'wp-remote-db-local-redis.test',
412+
411413
];
412414

413415
$result = EE::launch( 'sudo bin/ee site list --format=text',false, true );
@@ -431,9 +433,9 @@ public static function cleanup(AfterFeatureScope $scope)
431433
*/
432434
public function checkGlobalRedisCacheOfSite($site)
433435
{
434-
exec("docker exec -it ee-global-redis redis-cli set 'easyengine' 'rock'");
436+
exec("docker exec -it ee-global-redis redis-cli set 'easyengine' 'rocks'");
435437
$output = exec("docker exec -it ee-global-redis redis-cli get 'easyengine'");
436-
if ( '"rock"' !== $output ) {
438+
if ( '"rocks"' !== $output ) {
437439
throw new Exception("Global redis not working for $site site. Getting '$output' instead of 'rock'");
438440
}
439441
exec("docker exec -it ee-global-redis redis-cli del 'easyengine'");
@@ -445,11 +447,12 @@ public function checkGlobalRedisCacheOfSite($site)
445447
public function checkLocalRedisCacheOfSite($site)
446448
{
447449
$site_root_folder = EE_SITE_ROOT . '/' . $site;
448-
exec("cd $site_root_folder && docker-compose exec redis redis-cli set 'easyengine' 'rock'");
450+
exec("cd $site_root_folder && docker-compose exec redis redis-cli set 'easyengine' 'rocks'");
449451
$output = exec("cd $site_root_folder && docker-compose exec redis redis-cli get 'easyengine'");
450-
if ( '"rock"' !== $output ) {
452+
if ( '"rocks"' !== $output ) {
451453
throw new Exception("Local redis not working for $site site. Getting '$output' instead of 'rock'.");
452454
}
453455
exec("cd $site_root_folder && docker-compose exec redis redis-cli del 'easyengine'");
454456
}
457+
455458
}

features/site.feature

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ Feature: Site Command
191191

192192
Scenario: Create WordPress site with local DB and global redis
193193
When I run 'bin/ee site create wp-local-db.test --cache --type=wp --local-db'
194-
Then After delay of 5 seconds
194+
Then After delay of 2 seconds
195195
And The site 'wp-local-db.test' should have webroot
196196
And The site 'wp-local-db.test' should have WordPress
197197
And Request on 'wp-local-db.test' should contain following headers:
@@ -201,7 +201,7 @@ Feature: Site Command
201201

202202
Scenario: Create WordPress site with local redis and global db
203203
When I run 'bin/ee site create wp-local-redis.test --cache --type=wp --with-local-redis'
204-
Then After delay of 5 seconds
204+
Then After delay of 2 seconds
205205
And The site 'wp-local-redis.test' should have webroot
206206
And The site 'wp-local-redis.test' should have WordPress
207207
And Request on 'wp-local-redis.test' should contain following headers:
@@ -211,10 +211,30 @@ Feature: Site Command
211211

212212
Scenario: Create WordPress site with local DB and local redis
213213
When I run 'bin/ee site create wp-local-db-redis.test --cache --type=wp --local-db --with-local-redis'
214-
Then After delay of 5 seconds
214+
Then After delay of 2 seconds
215215
And The site 'wp-local-db-redis.test' should have webroot
216216
And The site 'wp-local-db-redis.test' should have WordPress
217217
And Request on 'wp-local-db-redis.test' should contain following headers:
218218
| header |
219219
| HTTP/1.1 200 OK |
220220
And Check local redis cache for 'wp-local-db-redis.test'
221+
222+
Scenario: Create WordPress site with remote DB and local redis
223+
When I run 'bin/ee site create wp-remote-db-local-redis.test --cache --type=wp --dbuser="root" --dbpass="" --dbhost="localhost" --with-local-redis'
224+
Then After delay of 2 seconds
225+
And The site 'wp-remote-db-local-redis.test' should have webroot
226+
And The site 'wp-remote-db-local-redis.test' should have WordPress
227+
And Request on 'wp-remote-db-local-redis.test' should contain following headers:
228+
| header |
229+
| HTTP/1.1 200 OK |
230+
And Check local redis cache for 'wp-remote-db-local-redis.test'
231+
232+
Scenario: Create WordPress site with remote DB and global redis
233+
When I run 'bin/ee site create wp-remote-db-global-redis.test --cache --type=wp --dbuser="travis" --dbpass="" --dbhost="127.0.01"'
234+
Then After delay of 2 seconds
235+
And The site 'wp-remote-db-global-redis.test' should have webroot
236+
And The site 'wp-remote-db-global-redis.test' should have WordPress
237+
And Request on 'wp-remote-db-global-redis.test' should contain following headers:
238+
| header |
239+
| HTTP/1.1 200 OK |
240+
And Check local redis cache for 'wp-remote-db-global-redis.test'

0 commit comments

Comments
 (0)