test: add dual DB engine test coverage with RocksDB support#12
Open
vividctrlalt wants to merge 3 commits intodevelopfrom
Open
test: add dual DB engine test coverage with RocksDB support#12vividctrlalt wants to merge 3 commits intodevelopfrom
vividctrlalt wants to merge 3 commits intodevelopfrom
Conversation
- Extract shared test logic into DbDataSourceImplTest, BaseMethodTest, TestConstants - Enable DB engine override via system property so tests run against both engines - Refactor 20+ test classes to support dual-engine testing - Fix flaky tests: FreezeTest, FreezeV2Test, VoteTest, ManagerTest, ShieldedReceiveTest - Update build.gradle and CI workflow accordingly
e61d378 to
a9dfd5b
Compare
Add assumeLevelDbAvailable() to DBIteratorTest.testLevelDb to skip when LevelDB JNI is unavailable on ARM64 platforms. Co-Authored-By: 3for <zouyudi@gmail.com>
On ARM64, LevelDB is not available at build time. Instead of throwing an exception that breaks default config startup, warn and override to RocksDB. Also uses equalsIgnoreCase for consistency.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
java-tron supports both LevelDB and RocksDB, but the test suite only ran with the default engine (LevelDB). This PR adds dual DB engine test coverage so the same business tests can run under both engines, and fixes several related issues.
What changed
testWithRocksDbtask sets-Dstorage.db.engine=ROCKSDB, whichConfigFactory.load()merges automatically — no code changes needed in individual testsStorage.getDbEngineFromConfig()to explicitArgs.validateConfig(), called inFullNode.main()DbDataSourceImplTestwith@RunWith(Parameterized.class)to run common DB operations against both LevelDB and RocksDB, eliminating ~400 lines of duplicate codeBaseMethodTest: New base class for tests requiring per-method Spring context isolationTrieTest,ConditionallyStopTest,NeedBeanConditionnull-safety,NativeMessageQueueshutdown hooktestWithRocksDbstep topr-check.ymlfor x86_64 buildsWhy
Test plan
./gradlew :framework:test— all existing tests pass./gradlew :framework:checkstyleTest— clean