diff --git a/test/blackbox/helpers_redis.bash b/test/blackbox/helpers_redis.bash index 7b403fbc62..676200aa1e 100644 --- a/test/blackbox/helpers_redis.bash +++ b/test/blackbox/helpers_redis.bash @@ -6,10 +6,13 @@ ZB_PATH=${ROOT_DIR}/bin/zb-${OS}-${ARCH} TEST_DATA_DIR=${BATS_FILE_TMPDIR}/test/data function redis_start() { - docker run -d --name redis_server -p 6379:6379 redis + local cname="$1" + local free_port="$2" + docker run -d --name ${cname} -p ${free_port}:6379 redis } function redis_stop() { - docker stop redis_server - docker rm -f redis_server + local cname="$1" + docker stop ${cname} + docker rm -f ${cname} } diff --git a/test/blackbox/redis_local.bats b/test/blackbox/redis_local.bats index cbc86109bf..e7b15815da 100644 --- a/test/blackbox/redis_local.bats +++ b/test/blackbox/redis_local.bats @@ -31,7 +31,8 @@ function setup_file() { fi # Setup redis server - redis_start + redis_port=$(get_free_port) + redis_start redis_server_local ${redis_port} # Setup zot server local zot_root_dir=${BATS_FILE_TMPDIR}/zot @@ -49,7 +50,7 @@ function setup_file() { "cacheDriver": { "name": "redis", "rootDir": "${zot_root_dir}/_redis", - "url": "redis://localhost:6379" + "url": "redis://localhost:${redis_port}" } }, "http": { @@ -63,6 +64,9 @@ function setup_file() { "extensions": { "ui": { "enable": true + }, + "search": { + "enable": true } } } @@ -111,5 +115,5 @@ EOF function teardown_file() { zot_stop_all - redis_stop + redis_stop redis_server_local } diff --git a/test/blackbox/redis_s3.bats b/test/blackbox/redis_s3.bats index 8a66325a8c..6d5325e3e1 100644 --- a/test/blackbox/redis_s3.bats +++ b/test/blackbox/redis_s3.bats @@ -7,16 +7,6 @@ load helpers_redis load helpers_cloud function verify_prerequisites() { - if [ ! $(command -v curl) ]; then - echo "you need to install curl as a prerequisite to running the tests" >&3 - return 1 - fi - - if [ ! $(command -v jq) ]; then - echo "you need to install jq as a prerequisite to running the tests" >&3 - return 1 - fi - if [ ! $(command -v docker) ]; then echo "you need to install docker as a prerequisite to running the tests" >&3 return 1 @@ -32,7 +22,8 @@ function setup_file() { fi # Setup redis server - redis_start + redis_port=$(get_free_port) + redis_start redis_server ${redis_port} # Setup zot server local zot_root_dir=${BATS_FILE_TMPDIR}/zot @@ -52,7 +43,7 @@ function setup_file() { "cacheDriver": { "name": "redis", "rootDir": "${zot_root_dir}/_redis", - "url": "redis://localhost:6379" + "url": "redis://localhost:${redis_port}" }, "storageDriver": { "name": "s3", @@ -75,12 +66,15 @@ function setup_file() { "extensions": { "ui": { "enable": true + }, + "search": { + "enable": true } } } EOF - awslocal s3 --region "us-east-2" mb s3://zot-storage + awslocal s3 ls s3://zot-storage || awslocal s3 --region "us-east-2" mb s3://zot-storage zot_serve ${ZOT_PATH} ${zot_sync_ondemand_config_file} wait_zot_reachable ${zot_port} @@ -123,5 +117,5 @@ EOF function teardown_file() { zot_stop_all - redis_stop + redis_stop redis_server }