diff --git a/examples/Advanced/docker-compose.yml b/examples/Advanced/docker-compose.yml index c46769d..2f454e8 100644 --- a/examples/Advanced/docker-compose.yml +++ b/examples/Advanced/docker-compose.yml @@ -7,10 +7,10 @@ services: environment: - MYSQL_ROOT_PASSWORD=root redis: - image: redis:alpine + image: redis:7.2.5-alpine ports: - 6379:6379 sba: image: michayaak/spring-boot-admin:2.2.2 ports: - - 8080:8080 \ No newline at end of file + - 8080:8082 \ No newline at end of file diff --git a/tests/health/README.md b/tests/health/README.md new file mode 100644 index 0000000..3fa5197 --- /dev/null +++ b/tests/health/README.md @@ -0,0 +1,15 @@ +# Running help-provider tests +By default, the health-provider tests are skipped unless the monitoried systems are runnign and are configured. + +In order to run all the tests health-provider tests at once, you'll need to start and configure MySQL and Redis servers. + +The easiest way to do so, is using docker-compose to run the advanced-example. + +1. Start MySQL and Redis - from the `example/Advanced` folder, run: + ``` + docker-compose --project-name example --file docker-compose.yml up --force-recreate + ``` +1. Run the tests - from the `tests/health` folder, run: + ``` + TEST_MYSQL_SERVER=localhost TEST_REDIS_SERVER=localhost poetry run pytest + ``` \ No newline at end of file diff --git a/tests/health/test_aioredis_health_provider.py b/tests/health/test_aioredis_health_provider.py index fbfce70..eaa3ba3 100644 --- a/tests/health/test_aioredis_health_provider.py +++ b/tests/health/test_aioredis_health_provider.py @@ -31,7 +31,7 @@ def test_aioredis_health(redis_host: str) -> None: redis_instance = AioRedis(host=redis_host) health = AioRedisHealthProvider(redis_instance).get_health() - assert health == RedisHealthStatus(Status.UP, RedisHealthDetails("5.0.3", "standalone")) + assert health == RedisHealthStatus(Status.UP, RedisHealthDetails("7.2.5", "standalone")) @pytest.mark.usefixtures("require_redis", "require_redis_server") @@ -44,4 +44,4 @@ def test_aioredis_bad_password(redis_host: str) -> None: health = AioRedisHealthProvider(redis_instance).get_health() assert health.status == Status.DOWN - assert "Client sent AUTH, but no password is set" in str(health.details.failure) + assert "called without any password configured for the default user" in str(health.details.failure) diff --git a/tests/health/test_redis_health_provider.py b/tests/health/test_redis_health_provider.py index 214e01b..77f8400 100644 --- a/tests/health/test_redis_health_provider.py +++ b/tests/health/test_redis_health_provider.py @@ -30,7 +30,7 @@ def test_redis_health(redis_host: str) -> None: from pyctuator.health.redis_health_provider import RedisHealthProvider, RedisHealthStatus, RedisHealthDetails health = RedisHealthProvider(redis.Redis(host=redis_host)).get_health() - assert health == RedisHealthStatus(Status.UP, RedisHealthDetails("5.0.3", "standalone")) + assert health == RedisHealthStatus(Status.UP, RedisHealthDetails("7.2.5", "standalone")) @pytest.mark.usefixtures("require_redis", "require_redis_server") @@ -41,4 +41,4 @@ def test_redis_bad_password(redis_host: str) -> None: health = RedisHealthProvider(redis.Redis(host=redis_host, password="blabla")).get_health() assert health.status == Status.DOWN - assert "Client sent AUTH, but no password is set" in str(health.details.failure) + assert "called without any password configured for the default user" in str(health.details.failure)