engine/test: Rework StorageEngine
's test utils #1494
No reviewers
Labels
No labels
P0
P1
P2
P3
badger
frostfs-adm
frostfs-cli
frostfs-ir
frostfs-lens
frostfs-node
good first issue
triage
Infrastructure
blocked
bug
config
discussion
documentation
duplicate
enhancement
go
help wanted
internal
invalid
kludge
observability
perfomance
question
refactoring
wontfix
No milestone
No project
No assignees
4 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: TrueCloudLab/frostfs-node#1494
Loading…
Reference in a new issue
No description provided.
Delete branch "a-savchuk/frostfs-node:prettify-engine-test-utils"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Close #1491
testNewShard
andsetInitializedShards
because they violated the default engine workflow. The correct workflow is: first useNew()
, followed byOpen()
, and thenInit()
. As a result, adding new logic to(*StorageEngine).Init
caused several tests to fail with a panic when attempting to access uninitialized resources. Now, all engines created with the test utils must beinitialized manually. The new helper method
prepare
can be used for that purpose.setInitializedShards
hardcoded the shard worker pool size, which prevented it from being configured in tests and benchmarks. This has been fixed as well.setShardsNumOpts
,setShardsNumAdditionalOpts
, andsetShardsNum
. Make them all depend onsetShardsNumOpts
.BenchmarkExists
toexists_test.go
93ed775e9cb97db5f285
tobd772c4da3
@ -43,1 +42,3 @@
s2 := testNewShard(t)
te := testNewEngine(t).setShardsNum(t, 2)
e := te.engine
require.NoError(t, e.Open(context.Background()))
What about making
init()
method on the test engine?The point of test helpers is to reduce boilerplate, it is much shorter to use
testNewEngine(t).setShardsNum(t, 2).init()
thante := testNewEngine(t).setShardsNum(t, 2)
+ 2 more lines.bd772c4da3
to7fc6101bec
WIP: engine/test: Reworkto engine/test: ReworkStorageEngine
's test utilsStorageEngine
's test utils