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

Improve JDBC integration tests #1747

Merged
merged 6 commits into from
May 21, 2024
Merged

Conversation

komamitsu
Copy link
Contributor

@komamitsu komamitsu commented May 17, 2024

Description

In the current JDBC integration tests, there is room to improve a few points.

  1. Some integration test codes use the return value of RdbEngineStrategy.toString() or equivalent to know the actual class (RdbEngineXxxxxx) that implements RdbEngineStrategy interface since RdbEngineXxxxxxs are package-private. These string comparisons can be replaced with class type comparison.
  1. SchemaLoaderIntegrationTestBase#createTablesThenDeleteTables_ShouldExecuteProperly() with YugabyteDB sometimes failed even with 10 seconds wait (e.g., https://github.com/scalar-labs/scalardb/actions/runs/9123522841/job/25086080469). We need to manually retry failed job in this case. We've already found retrying for the test case works well.

Related issues and/or PRs

https://github.com/scalar-labs/scalardb/pull/1744/files#r1603305279

Changes made

  • For 1, added and made some test cases use JdbcTestUtils.ixXxxxxx(RdbEngineStrategy)
  • For 2, updated SchemaLoaderIntegrationTestBase#createTablesThenDeleteTables_ShouldExecuteProperly() to retry in the case of YugabyteDB. Also, the 10 second wait can be reduced to 1 second.

Checklist

The following is a best-effort checklist. If any items in this checklist are not applicable to this PR or are dependent on other, unmerged PRs, please still mark the checkboxes after you have read and understood each item.

  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation to reflect the changes.
  • Any remaining open issues linked to this PR are documented and up-to-date (Jira, GitHub, etc.).
  • Tests (unit, integration, etc.) have been added for the changes.
  • My changes generate no new warnings.
  • Any dependent changes in other PRs have been merged and published.

Additional notes (optional)

None

Release notes

N/A

@komamitsu komamitsu self-assigned this May 17, 2024
@komamitsu komamitsu changed the title Add JdbcTestUtils.isXxxxx() to decide RdbEngineStrategy class in more robust way Improve JDBC integration tests May 17, 2024
@@ -56,6 +56,7 @@ sourceSets {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
srcDir file('src/integration-test/java')
include '**/com/scalar/db/storage/jdbc/*.java'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

integrationTestMultiStorage needs to be able to access com.scalar.db.storage.jdbc.JdbcTestUtils

// - Create a new method to retry only for the method
Uninterruptibles.sleepUninterruptibly(10000, TimeUnit.MILLISECONDS);
if (JdbcTestUtils.isYugabyte(rdbEngine)) {
Uninterruptibles.sleepUninterruptibly(1000, TimeUnit.MILLISECONDS);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

With the retry, such a long wait is no longer needed.

Copy link
Collaborator

@brfrn169 brfrn169 left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you!

Copy link
Contributor

@Torch3333 Torch3333 left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

Copy link
Contributor

@feeblefakie feeblefakie left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you!

@feeblefakie feeblefakie merged commit bb62b1a into master May 21, 2024
24 checks passed
@feeblefakie feeblefakie deleted the add-isyugabyte-in-integration-test branch May 21, 2024 08:37
komamitsu added a commit that referenced this pull request May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants