Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Reuse Containers in tests; Add Test parameters #1853

Merged
merged 16 commits into from
Sep 12, 2023
Merged

Conversation

e5l
Copy link
Member

@e5l e5l commented Sep 4, 2023

This PR adds parameters to the test tasks: container, database, and dialect. It also makes all modules and tests using the same database containers, avoiding starting a new one.

Two gradle tasks were introduced: startCompose, stopCompose. With this 2 tasks you can warmup containers before testing, so no containers will be restarted.

@e5l e5l requested review from joc-a and bog-walk September 4, 2023 13:21
@e5l e5l self-assigned this Sep 4, 2023
@e5l e5l force-pushed the e5l/buildscripts branch 2 times, most recently from 4935aab to 0b12665 Compare September 4, 2023 13:34
@e5l
Copy link
Member Author

e5l commented Sep 4, 2023

Failed after rebase, will take a look

@e5l e5l marked this pull request as draft September 4, 2023 13:57
@e5l e5l marked this pull request as ready for review September 4, 2023 14:29
@e5l
Copy link
Member Author

e5l commented Sep 4, 2023

Fixed

Copy link
Member

@bog-walk bog-walk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than the comments about MariaDB and SQL Server:

  • Can confirm that startCompose and stopCompose work as expected on my end.
  • Gradle task test behaves a little different now in that it runs all tests in all files in all databases.
    • Would it be possible to have a task to run a single test (or a single test file) using all databases at once? Or maybe I missed a way?
  • Having the database and dialect as part of the test name in the Test runner tab is going to be so helpful! 😄

Very excited for this PR! ❤️

@e5l
Copy link
Member Author

e5l commented Sep 6, 2023

@bog-walk, yep. I've noticed it's starting to be slightly different with test task. I will try to wire things as before.
Thank for the review!

@e5l e5l force-pushed the e5l/buildscripts branch 2 times, most recently from 8d6d01e to 66e4af7 Compare September 6, 2023 12:54
@joc-a
Copy link
Collaborator

joc-a commented Sep 6, 2023

This is what I get when running ./gradlew test. Some tests are failing other than the ones in my local report, but they don't show up here and it still shows "BUILD SUCCESSFUL".

2992 tests completed, 3 failed, 298 skipped
There were failing tests. See the report at: file:///Users/User/Exposed/exposed-tests/build/reports/tests/testH2/index.html

> Task :sqlserverComposeDown
You're trying to stop the containers, but stopContainers is set to false. Please use composeDownForced task instead.

> Task :postgresComposeDown
You're trying to stop the containers, but stopContainers is set to false. Please use composeDownForced task instead.

> Task :oracleComposeDown
You're trying to stop the containers, but stopContainers is set to false. Please use composeDownForced task instead.

> Task :mysql8ComposeDown
You're trying to stop the containers, but stopContainers is set to false. Please use composeDownForced task instead.

> Task :mysqlComposeDown
You're trying to stop the containers, but stopContainers is set to false. Please use composeDownForced task instead.

> Task :mariadbComposeDown
You're trying to stop the containers, but stopContainers is set to false. Please use composeDownForced task instead.

BUILD SUCCESSFUL in 9m 49s
152 actionable tasks: 29 executed, 123 up-to-date

For example, testSqrtFunction fails for SQLServer:

Failed on sqlserver.. Expected an exception of class java.sql.SQLException to be thrown, but was java.lang.IllegalStateException: Unexpected value of type Double: NaN of kotlin.Double
java.lang.AssertionError: Failed on sqlserver.. Expected an exception of class java.sql.SQLException to be thrown, but was java.lang.IllegalStateException: Unexpected value of type Double: NaN of kotlin.Double
	at org.junit.Assert.fail(Assert.java:89)
	

Copy link
Member

@bog-walk bog-walk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All gradle tasks work well on my end. Looks great!

@joc-a
Copy link
Collaborator

joc-a commented Sep 11, 2023

@e5l This test is failing for me
Screenshot 2023-09-11 at 12 01 47 PM

@e5l
Copy link
Member Author

e5l commented Sep 12, 2023

@joc-a, thanks! fixed

@e5l e5l merged commit 28404d7 into main Sep 12, 2023
3 checks passed
@e5l e5l deleted the e5l/buildscripts branch September 12, 2023 09:36
saral pushed a commit to saral/Exposed that referenced this pull request Oct 3, 2023
* Make all build scripts indexed, cleanup unused plugin

* Update dependencies

* Add explicit SERVICE_HOST to avoid network issues with Docker 20.* on linux

* Do not log ignored tests

* Prevent db containers to restart in tests

* Cleanup docker plugin usages

* Fix db credentials

* Add test name to parameters

* Reduce columns iteration time

* Reduce date time test time

* Migrate to faster oracle container

* Force drop table before test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants