Open Closed

Unit Tests crush after ABP 5.0 update #2309


User avatar
0
mustafasezgin created

After updating to ABP 5.0, our unit tests started to give exceptions about related project's (Domain project which has RabbitMQ connection configuration) RabbitMQ broker connection if it is not connected to broker. In the previous versions unit tests didn't crush when this connection was not established. As a note: Our unit tests don't have any configuration about broker. It crushes because they are using the Domain project.


5 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    What is your previous version?

    Is there an error just because of upgrading to 5.0?

    You should exclude Rabbitmq from your unit tests.

  • User Avatar
    0
    mustafasezgin created

    What is your previous version?

    Is there an error just because of upgrading to 5.0?

    You should exclude Rabbitmq from your unit tests.

    Previous version was 4.4.2.

    Unit Test projects have reference to Domain project and Domain project is trying to connect to broker(RabbitMQ). In the previous version, the failure of Domain project connection, did not prevent the unit tests from passing.

    I did not change anything besides version update.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Domain project is trying to connect to broker(RabbitMQ)

    You can try to prevent it from connecting in the unit test. eg: Create a service to connecting then mock it in the unit test.

  • User Avatar
    0
    mustafasezgin created

    Domain project is trying to connect to broker(RabbitMQ)

    You can try to prevent it from connecting in the unit test.eg: Create a service to connecting then mock it in the unit test.

    Can you explain a little more, please?

    My project's DomainModule looks like below, and I configure the broker from here.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    You can add a service to configure AbpRabbitMqOptions. Remove this service from DI in the unit test.

    https://andrewlock.net/simplifying-dependency-injection-for-iconfigureoptions-with-the-configureoptions-helper/

Made with ❤️ on ABP v9.1.0-preview. Updated on December 13, 2024, 06:09