spring-projects / spring-ai

An Application Framework for AI Engineering
https://docs.spring.io/spring-ai/reference/index.html
Apache License 2.0
3.23k stars 822 forks source link

Several test failures during the 'mvn package' process #1360

Closed Sinclo closed 1 month ago

Sinclo commented 1 month ago

Bug description

When running the mvn package or mvn clean package command, the package process fails on the "Spring AI Core" module, due to several test failures in the "BeanOutputConverterTest" class.

Note:

Environment

Steps to reproduce

Option A:

  1. From the terminal, perform mvn clean package. Observe the test failures

Option B:

  1. Run mvn clean (this will return successful build logs)
  2. Run mvn package (this will return the test failures)

The main thing is running mvn package in some way, to produce the failures.

Expected behavior

Minimal Complete Reproducible example

Other notes

The test failures seem bizarre, and there's no immediate reason that I can see as to why these issues are happening. But unfortunately its happening, hence this issue being filed. I am still actively investigating this issue as well, just in case this turns out being a silly "me" issue in some way.

Sinclo commented 1 month ago

While looking at one of the sample snippets provided in my previous comment (20240913_formatTypeReferenceArray_IndividualTestFailure.txt), I did observe a difference in indentations between the expected vs actual result (even though my IDE did not point this out).

Indentation_from_logs

As seen in the image, the closing bracket under the actual results is indented by 2 characters (column 3). Meanwhile the closing bracket under the expected results is under column 1.

Sinclo commented 1 month ago

Further investigation shows that

  1. The tests specifically in the "BeanOutputConverterTest" class are failing, due to only expecting the use of \n as part of formatting, but actually using \r\n in its actual format output. Example of "actual results" can be seen in the following screenshot. jsonSchema_debug_mode

  2. I've also discovered that the reason for mvn package failing goes well beyond the BeanOutputConverterTest class. This process failing is actually caused by numerous test failures and errors from other test classes as well (i.e. ContentFormatterTests.java, OllamaRuntimeHintsTests.java, PagePdfDocumentReaderTests.java, etc). . In other words, even if all of the test failures in the "BeanOutputConverterTest" class are addressed as part of the initial reported issue, mvn package will continue to fail until further effort is put into several additional classes & tests across the project as well.

Sinclo commented 1 month ago

Closing this issue. After further digging, it appears the test failures I'm facing are specific to the IDE that I'm using (IntelliJ IDEA), and seem to be specific to the line separator settings.

I've tried several steps to resolve the issue in the IDE with no luck. That said, while I haven't yet found a fix to the problem, I do know enough to say that the failures seem to be a problem with the IDE, not with the tests.