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

[#2414] improved(core): Make the unit tests for entity storage unified in the core module #2545

Merged
merged 5 commits into from
Mar 27, 2024

Conversation

xloya
Copy link
Contributor

@xloya xloya commented Mar 15, 2024

What changes were proposed in this pull request?

The purpose of this PR is to unify some of the unit tests of the Entity Store to ensure that the same results can be obtained.

Why are the changes needed?

Fix: #2414

How was this patch tested?

Using the modified unit tests.

@xloya xloya closed this Mar 15, 2024
@xloya xloya reopened this Mar 15, 2024
@xloya xloya closed this Mar 15, 2024
@xloya xloya reopened this Mar 15, 2024
@xloya xloya closed this Mar 18, 2024
@xloya xloya reopened this Mar 18, 2024
@xloya
Copy link
Contributor Author

xloya commented Mar 18, 2024

cc @yuqi1129 @jerryshao

@@ -0,0 +1,71 @@
/*
* Copyright 2023 Datastrato Pvt Ltd.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Only the package path was changed, so the original license was maintained.

public static final String KV_STORE_PATH =
"/tmp/gravitino_kv_entityStore_" + UUID.randomUUID().toString().replace("-", "");

private static final String JDBC_STORE_PATH =
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need the storage path when using JDBC storage? Is the directory for storing H2 files there?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

H2 supports some connection modes, here we use the embedded mode to save the data, see: https://www.h2database.com/html/features.html#embedded_databases

@@ -234,4 +236,164 @@ void testRemoveWithGCCollector() throws IOException, InterruptedException {
}
}
}

@Test
void testRemoveWithGCCollector2() throws IOException, InterruptedException {
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the difference between testRemoveWithGCCollector2 and the old one?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The unit test testRemoveWithGCCollector2 was originally saved in the TestKvEntityStorage class. Since it has the same name as the unit test method in TestKvGarbageCollector, 1 and 2 are added to distinguish them. The test logic of testRemoveWithGCCollector1 and testRemoveWithGCCollector2 is slightly different, and there is no direct deletion here.

Copy link
Contributor

@yuqi1129 yuqi1129 left a comment

Choose a reason for hiding this comment

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

LGTM

@yuqi1129 yuqi1129 merged commit 50256c8 into apache:main Mar 27, 2024
12 checks passed
yuqi1129 added a commit to yuqi1129/gravitino that referenced this pull request Mar 27, 2024
coolderli pushed a commit to coolderli/gravitino that referenced this pull request Apr 2, 2024
…unified in the core module (apache#2545)

### What changes were proposed in this pull request?

The purpose of this PR is to unify some of the unit tests of the `Entity
Store` to ensure that the same results can be obtained.

### Why are the changes needed?

Fix: apache#2414 

### How was this patch tested?

Using the modified unit tests.

---------

Co-authored-by: xiaojiebao <[email protected]>
@xloya xloya deleted the unified-entity-store-uts branch June 20, 2024 01:42
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.

[Improvement] Make the unit tests for entity storage unified
2 participants