Repository navigation
test: add coverage across struct, commons, server, pd, store and cluster - #3309
Open
bitflicker64 wants to merge 6 commits into
Open
bitflicker64 wants to merge 6 commits into
bitflicker64 wants to merge 6 commits into
Conversation
Add struct-local tests for BytesBuffer varint rejection, unsigned limits, length-prefixed bytes, string endings, edge and index id encoding, partition and OLAP id parsing, tagged collections and buffer growth, plus EdgeId text form, parse errors and binary id generation.
Add common tests for typed option parsing and checkers, HugeConfig URL normalization and input validation, and HostNameVerifier negative paths (SAN matching, wildcard scope, IP vs DNS, no CN fallback). Add an RPC test for self URL exclusion, invalid RpcOptions, provider and consumer config, and service cleanup on destroy. Register all in UnitTestSuite.
Add unit tests for RocksDBStdSessions lifecycle and error paths (unopened tables, rollback, reopen, lock release on force close and bad options, iterator double close, snapshot path), the RocksDB iterator pool, and HStore table partition routing. Register them in UnitTestSuite together with the existing ConsumersTest, MemoryAllocateTest and MemoryManageTest, which compiled but never ran.
Add PD core tests for KVOperation encoding and whitelist decoding, RaftKVStore write routing through raft (leader check, raft failure, state machine replay), PeerUtil config parsing and ZipUtils snapshot checksums and zip-slip handling. Register them, plus the existing RaftReflectionUtilTest, in PDCoreSuiteTest.
Add Store tests for Base58 encoding, edge owner keys, CRC64, both ZipUtils copies (round trip and zip-slip entries), SessionOperator writes, ranges, iterator release and snapshots, partition and shard group metadata, and HgBufferProxy flow control. Register them, plus the existing HgStoreStateMachineTest, FutureClosureTest, HgAssertTest and HgPairTest, in the matching suites.
Add SimpleClusterGraphTest, which creates schema, vertices and an edge through the server, reads them back by id and by adjacency through the HStore backend, and checks that invalid vertex requests and unknown ids are rejected. Register it in SimpleClusterSuiteTest.
Open
3 of 11 tasks
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3309 +/- ##
============================================
+ Coverage 41.57% 41.93% +0.36%
- Complexity 7025 7103 +78
============================================
Files 762 761 -1
Lines 67060 66190 -870
Branches 9021 8920 -101
============================================
- Hits 27880 27758 -122
+ Misses 35969 35255 -714
+ Partials 3211 3177 -34 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Purpose of the PR
Before 1.8.0 we wanted more executable tests module by module, with attention to the parts that changed recently: the Java 17 migration, the new
hugegraph-structmodule, and the RocksDB and JRaft upgrades. Several test classes in the repository also compiled but never ran, because no suite or Surefire include picked them up.This PR only touches test classes and suite registration. There are no production, dependency, configuration, CI or documentation changes. Each module is a separate commit so it can be reviewed on its own.
Main Changes
test(struct)BytesBufferTest: varint rejection, unsigned limits, length-prefixed bytes, string endings, edge and index id encoding, partition and OLAP id parsing, tagged collections, buffer growth.EdgeIdTest: text form, parse errors, binary id generation.test(commons)TypedOptionTest(option parsing and checkers),HugeConfigValidationTest(URL normalization, input validation),HostNameVerifierTest(negative paths after #3307: SAN matching, wildcard scope, IP vs DNS, no CN fallback), rpcRpcConfigTest(self URL exclusion, invalid options, provider and consumer config, service cleanup on destroy).test(server)RocksDBStdSessionsLifecycleTest(unopened tables, rollback, reopen, lock release after force close and bad options, iterator double close, snapshot path),RocksDBIteratorPoolTest,HstoreTableRoutingTest. RegistersConsumersTest,MemoryAllocateTestandMemoryManageTest, which existed but never ran.test(pd)KVOperationTest(encoding, null checks, truncated input, whitelist decoding),RaftKVStoreTest(writes go through raft, leader check, raft failure, state machine replay),PeerUtilTest,ZipUtilsTest(snapshot checksums, zip-slip entries). RegistersRaftReflectionUtilTest.test(store)Base58EncoderTest,KeyUtilTest,CRC64Test,ZipUtilsPathSafetyTest(both ZipUtils copies),SessionOperatorTest(writes, ranges, iterator release, snapshots),PartitionMetaCodecTest,HgBufferProxyTest. RegistersHgStoreStateMachineTest,FutureClosureTest,HgAssertTestandHgPairTest. ThereuseForks=falsesetting of the core execution is unchanged.test(cluster)SimpleClusterGraphTest: creates schema, vertices and an edge through the server, reads them back by id and by adjacency through the HStore backend, and checks that invalid vertex requests and unknown ids are rejected.New RocksDB tests use
TemporaryFolderinstead of fixed paths. No new test binds a fixed port.Verifying these changes
36bc1c64b. The figures are run/failed/errors/skipped.mvn test -pl hugegraph-structmvn test -pl hugegraph-commons/hugegraph-common -Dtest=UnitTestSuite -DskipCommonsTests=falsemvn test -pl hugegraph-commons/hugegraph-rpc -Dtest=UnitTestSuite -DskipCommonsTests=falsemvn test -pl hugegraph-server/hugegraph-test -P unit-testmvn test -pl hugegraph-pd/hg-pd-test -P pd-core-testmvn test -pl hugegraph-store/hg-store-test -P store-common-test... -P store-rocksdb-test... -P store-raftcore-test... -P store-client-test... -P store-core-testmvn test -pl hugegraph-cluster-test/hugegraph-clustertest-test -P simple-cluster-testRestClientTestHTTPS tests time out reaching an external endpoint, and fourMachineInfoTesttests find no MAC or IP address on that machine.HeartbeatShutdownTest, in a checkout wherehg-store-nodehad not been compiled. With a full build it passes.mvn editorconfig:checkpasses on every touched test module.Does this PR potentially affect the following parts?
Documentation Status
Doc - TODO: required documentation is pending; complete it before merging.Doc - Done: documentation is included here or linked below.Doc - No Need: no user-visible documentation is affected.Documentation files in this PR or paired hugegraph-doc PR:
Known limitations
These tests were left out or left unregistered on purpose.
MemoryConsumerTestpasses on its own but fails insideUnitTestSuite. An earlier test terminates the sharedEventHubexecutor, and itsclearBackend()calls then getRejectedExecutionException. It is left unregistered and unchanged.PDWatchTesthas no assertions and needs a live PD.PDPulseTestis marked@Uselessand waits forever against a live PD without stores. Neither is registered.CoreSuiteTestTODO block pass on their own; they are left for a follow-up.multi-cluster-testwas not run locally.Some new tests exposed behaviour that looks wrong in production code. Those tests are not part of this PR; the findings will be reported separately:
IdUtil, an id part that ends with a backtick does not survive escaping and unescaping.SplicingIdGenerator.split(concat("a", "b"))returns["a>b"]`.BytesBuffer.readVIntandreadVLong, theleading == 0x80check compares a signed byte with 128, so it is never true.wrap({0x80, 1}).readVInt()returns 1.HugeConfig.validateOptionskips the option checker when a value is already of the target Java type. A port of 70000 passed as anIntegeris accepted.RocksDBStdSessions.scan()opens a native iterator before the scan arguments are checked, and never closes it when the check fails.