Skip to content

Commit

Permalink
add expiry to MOVED check + int test fix
Browse files Browse the repository at this point in the history
Signed-off-by: Shaanjot Gill <[email protected]>
  • Loading branch information
shaangill025 committed Oct 12, 2022
1 parent fc88a80 commit e3c6ec7
Show file tree
Hide file tree
Showing 7 changed files with 189 additions and 198 deletions.
38 changes: 18 additions & 20 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,21 @@ jobs:
name: Integration Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run integration tests - Redis host
run: |
docker-compose -f ./int/docker-compose.yml run tests
- name: Run integration tests - Redis cluster
run: |
docker network create --subnet=172.28.0.0/24 test_network
export REDIS_PASSWORD=test1234
export NETWORK_NAME=test_network
docker-compose -f ./int/docker-compose.yml down
docker-compose -f ./int/docker-compose.cluster.yml run tests
- name: Print logs on failure
if: failure()
run: |
docker-compose -f ./int/docker-compose.yml logs
docker-compose -f ./int/docker-compose.cluster.yml logs
- name: Clean up integration tests
if: always()
run: |
docker-compose -f ./int/docker-compose.cluster.yml down
- uses: actions/checkout@v2
- name: Run integration tests - Redis cluster
run: |
docker network create --subnet=172.28.0.0/24 test_network
export REDIS_PASSWORD=test1234
export NETWORK_NAME=test_network
docker-compose -f ./int/docker-compose.yml run tests-cluster
- name: Run integration tests - Redis host
run: |
docker-compose -f ./int/docker-compose.yml run tests-host
- name: Print logs on failure
if: failure()
run: |
docker-compose -f ./int/docker-compose.yml logs
- name: Clean up integration tests
if: always()
run: |
docker-compose -f ./int/docker-compose.yml down
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,7 @@ configuration options are defined as follows:

### Single redis host
```sh
$ docker-compose -f int/docker-compose.yml build
$ docker-compose -f int/docker-compose.yml run tests
$ docker-compose -f int/docker-compose.yml run tests-host
```

### Redis cluster
Expand All @@ -109,6 +108,5 @@ Cluster requires external docker network with specified subnet
$ docker network create --subnet=172.28.0.0/24 `network_name`
$ export REDIS_PASSWORD=" ... As specified in redis_cluster.conf ... "
$ export NETWORK_NAME="`network_name`"
$ docker-compose -f int/docker-compose.cluster.yml build
$ docker-compose -f int/docker-compose.cluster.yml run tests
$ docker-compose -f int/docker-compose.yml run tests-cluster
```
2 changes: 1 addition & 1 deletion acapy_cache_redis/v0_1/redis_base_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ async def check_for_redis_cluster(self):
# host then it will return None as it doesn't exists. Otherwise,
# it will raise a MOVED error.
fake_test_key = f"test_key_{str(uuid4())}"
await self.redis.set(fake_test_key, b"")
await self.redis.set(fake_test_key, b"", ex=1)
except aioredis.exceptions.ResponseError as err:
if "MOVED" in str(err):
self.redis = self.root_profile.inject_or(RedisCluster)
Expand Down
148 changes: 0 additions & 148 deletions int/docker-compose.cluster.yml

This file was deleted.

Loading

0 comments on commit e3c6ec7

Please sign in to comment.