Thursday 16 May 2024

Fixing Integration tests failure due to Order


The Maven Failsafe Plugin is used for running integration tests in a Maven project. It is designed to complement the Maven Surefire Plugin, which is used for running unit tests. The Failsafe Plugin allows for a separate lifecycle phase for integration tests, which typically run after the application has been packaged and deployed.

<plugin>

    <groupId>org.apache.maven.plugins</groupId>

    <artifactId>maven-failsafe-plugin</artifactId>

    <version>3.0.0-M5</version>

    <executions>

        <execution>

            <id>integration-test</id>

            <goals>

                <goal>integration-test</goal>

            </goals>

        </execution>

        <execution>

            <id>verify</id>

            <goals>

                <goal>verify</goal>

            </goals>

        </execution>

    </executions>

</plugin>

To configure the maven-failsafe-plugin to run integration tests in alphabetical order, Add the following configuration. <execution> <id>integration-test</id> <goals> <goal>integration-test</goal> </goals> <configuration> <runOrder>alphabetical</runOrder> </configuration> </execution> Helpful content from the article. First, we would like to know why a specific test failed. By default, Maven runs the tests in the order determined by our file system. This is the default setting for the runOrder property. This can be different on my Windows machine from the one on the Linux build system. Again frustration. A good aid could be if the build produces an easy-to-use output to tell, what was the real order of the tests. 


Some of the content was generated by ChatGPT after I asked some questions.

Monday 29 April 2024

Understanding Case Sensitivity in Liquibase Changelogs

When working with Liquibase to manage database schema changes, developers often encounter issues related to case sensitivity, especially when deploying changes across different environments. In this blog post, we'll explore the concept of case sensitivity in Liquibase changelogs and how it can impact database deployments.

What is Liquibase?

Liquibase is an open-source database schema migration tool that allows developers to manage and version database changes in a structured and repeatable manner. It uses changelog files to define database changes applied to the target database.

Understanding Case Sensitivity

One common issue that developers face when using Liquibase is case sensitivity. Unlike Windows, Linux file systems are typically case-sensitive, meaning file and directory names are treated as distinct based on case. This can lead to inconsistencies when working with Liquibase changelogs, especially when referencing database objects such as tables and columns.

Example Changelog

Let's consider the following example Liquibase changelog snippet:

<changeSet id="add_full_name_on_userprofile" author="shahzeb">

<addColumn tableName="userprofile"> <column name="full_name" type="VARCHAR(50)" defaultValue="regex"> <constraints nullable="false"/> </column> </addColumn> <comment>add full_name column</comment> </changeSet>

In this changelog, we're adding a new column named full_name to the userprofile table. Note that the table and column names are specified in lowercase, which may work fine on Windows but can lead to issues on Linux due to case sensitivity.






Wednesday 24 April 2024

Docker build crashing with error : failed to receive status: rpc error: code = Unavailable desc = error reading from server: EOF

 On Windows 10, Docker desktop, I received the following error when building an image. The build will take more than 30 minutes when reaches the following command.

RUN poetry config virtualenvs.create false && poetry update && poetry install --no-interaction --no-ansi

and throw the following error. 

failed to receive status: rpc error: code = Unavailable desc = error reading from server: EOF

I had to increase the allocated resources to the docker desktop to resolve the issue.