From 93a77d8e56ff9c61203c2b9b365c7b2460a5d29a Mon Sep 17 00:00:00 2001 From: Carlos Herrero Date: Mon, 7 Nov 2022 18:32:50 +0100 Subject: [PATCH] Fix Integration tests, they failed silently Fixed some tests failing with postgres and mysql --- README.md | 4 ++-- tests/test_replica/test_mixin.py | 6 +++--- travis_integration_tests.sh | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 77c3f33..bd6f869 100644 --- a/README.md +++ b/README.md @@ -215,8 +215,8 @@ Unit testing Run tests with various RDBMS: - `cd integration_tests` -- `DB=postgres docker-compose -f docker-compose.yml -f rdbms.yml up app_test` -- `DB=mysql docker-compose -f docker-compose.yml -f rdbms.yml up app_test` +- `DB=postgres docker-compose -f docker-compose.yml -f rdbms.yml run app_test` +- `DB=mysql docker-compose -f docker-compose.yml -f rdbms.yml run app_test` Check code style: `flake8` Run tests: `pytest` diff --git a/tests/test_replica/test_mixin.py b/tests/test_replica/test_mixin.py index afebc00..8b88e6e 100644 --- a/tests/test_replica/test_mixin.py +++ b/tests/test_replica/test_mixin.py @@ -546,7 +546,7 @@ def test_get_cqrs_retry_delay(settings, retry_delay, current_retry): assert result is retry_delay -@pytest.mark.django_db +@pytest.mark.django_db(transaction=True) def test_support_for_meta_create(): meta = TransportStub.consume( TransportPayload( @@ -565,7 +565,7 @@ def test_support_for_meta_create(): assert meta == {'Hello': 'world'} -@pytest.mark.django_db +@pytest.mark.django_db(transaction=True) def test_support_for_meta_update(): models.CQRSMetaModel.objects.create(id=2, cqrs_revision=0, cqrs_updated=now()) @@ -589,7 +589,7 @@ def test_support_for_meta_update(): ) -@pytest.mark.django_db +@pytest.mark.django_db(transaction=True) def test_support_for_meta_delete(): models.CQRSMetaModel.objects.create(id=3, cqrs_revision=0, cqrs_updated=now()) diff --git a/travis_integration_tests.sh b/travis_integration_tests.sh index bd55ab8..e315720 100755 --- a/travis_integration_tests.sh +++ b/travis_integration_tests.sh @@ -11,8 +11,8 @@ if [ "$INTEGRATION_TESTS" == "yes" ]; then docker-compose down --remove-orphans docker-compose -f docker-compose.yml -f kombu.yml run master docker-compose -f docker-compose.yml -f kombu.yml down --remove-orphans - DB=postgres docker-compose -f docker-compose.yml -f rdbms.yml up app_test - DB=mysql docker-compose -f docker-compose.yml -f rdbms.yml up app_test + DB=postgres docker-compose -f docker-compose.yml -f rdbms.yml run app_test + DB=mysql docker-compose -f docker-compose.yml -f rdbms.yml run app_test docker-compose -f docker-compose.yml -f rdbms.yml down --remove-orphans cd ..