diff --git a/README.md b/README.md index 33d5f6b..49f738d 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,11 @@ This repository allows you to quickly install Redis into a [DDEV](https://ddev.r 1. `ddev get ddev/ddev-redis` 2. `ddev restart` +With DDEV v1.23.5+ you can choose a different Redis tag, the command below creates a `.ddev/.env.redis` file that you can commit: + +1. `ddev dotenv set .ddev/.env.redis --redis-tag 7` +2. `ddev restart` + ## Explanation This Redis recipe for [DDEV](https://ddev.readthedocs.io) installs a [`.ddev/docker-compose.redis.yaml`](docker-compose.redis.yaml) using the `redis` Docker image. diff --git a/docker-compose.redis.yaml b/docker-compose.redis.yaml index 94f2ecb..d40217e 100644 --- a/docker-compose.redis.yaml +++ b/docker-compose.redis.yaml @@ -2,7 +2,7 @@ services: redis: container_name: ddev-${DDEV_SITENAME}-redis - image: redis:6-bullseye + image: redis:${REDIS_TAG:-6-bullseye} # These labels ensure this service is discoverable by ddev. labels: com.ddev.site-name: ${DDEV_SITENAME} diff --git a/tests/test.bats b/tests/test.bats index 502698b..288424f 100644 --- a/tests/test.bats +++ b/tests/test.bats @@ -14,10 +14,10 @@ teardown() { } @test "basic installation" { - ddev config --project-name=${PROJNAME} --project-type=drupal9 --docroot=web --create-docroot + ddev config --project-name=${PROJNAME} --project-type=drupal --docroot=web ddev start -y cd ${TESTDIR} - ddev get ${DIR} + ddev add-on get ${DIR} ddev restart ddev redis-cli INFO | grep "^redis_version:6." # Check if Redis configuration was setup. @@ -25,11 +25,26 @@ teardown() { grep -F 'settings.ddev.redis.php' web/sites/default/settings.php } +@test "basic installation with Redis tag 7" { + ddev config --project-name=${PROJNAME} --project-type=drupal --docroot=web + ddev start -y + cd ${TESTDIR} + ddev add-on get ${DIR} + ddev dotenv set .ddev/.env.redis --redis-tag=7 + # Check if .env file for Redis exists. + [ -f .ddev/.env.redis ] + ddev restart + ddev redis-cli INFO | grep "^redis_version:7." + # Check if Redis configuration was setup. + [ -f web/sites/default/settings.ddev.redis.php ] + grep -F 'settings.ddev.redis.php' web/sites/default/settings.php +} + @test "non-Drupal installation" { - ddev config --project-name=${PROJNAME} --project-type=laravel --docroot=web --create-docroot + ddev config --project-name=${PROJNAME} --project-type=laravel --docroot=web ddev start -y cd ${TESTDIR} - ddev get ${DIR} + ddev add-on get ${DIR} ddev restart ddev redis-cli INFO | grep "^redis_version:6." # Drupal configuration should not be present @@ -37,10 +52,10 @@ teardown() { } @test "Drupal 7 installation" { - ddev config --project-name=${PROJNAME} --project-type=drupal7 --docroot=web --create-docroot + ddev config --project-name=${PROJNAME} --project-type=drupal7 --docroot=web ddev start -y cd ${TESTDIR} - ddev get ${DIR} + ddev add-on get ${DIR} ddev restart ddev redis-cli INFO | grep "^redis_version:6." # Drupal configuration should not be present @@ -48,10 +63,10 @@ teardown() { } @test "Drupal 9 installation without settings management" { - ddev config --project-name=${PROJNAME} --disable-settings-management --project-type=drupal9 --docroot=web --create-docroot + ddev config --project-name=${PROJNAME} --disable-settings-management --project-type=drupal --docroot=web ddev start -y cd ${TESTDIR} - ddev get ${DIR} + ddev add-on get ${DIR} ddev restart ddev redis-cli INFO | grep "^redis_version:6." # Drupal configuration should not be present