Skip to content

Commit b121493

Browse files
authored
Add support for accelerating eviction in integration tests (#5716)
1 parent 6e0530d commit b121493

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

ingest/ledgerbackend/toml.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,9 @@ type captiveCoreTomlValues struct {
113113
BucketListDBMemoryForCaching *uint `toml:"BUCKETLIST_DB_MEMORY_FOR_CACHING,omitempty"`
114114
EnableEmitClassicEvents *bool `toml:"EMIT_CLASSIC_EVENTS,omitempty"`
115115
EnableBackfillStellarAssetEvents *bool `toml:"BACKFILL_STELLAR_ASSET_EVENTS,omitempty"`
116+
OverrideEvictionParamsForTesting *bool `toml:"OVERRIDE_EVICTION_PARAMS_FOR_TESTING,omitempty"`
117+
TestingStartingEvictionScanLevel *uint `toml:"TESTING_STARTING_EVICTION_SCAN_LEVEL,omitempty"`
118+
TestingMaxEntriesToArchive *uint `toml:"TESTING_MAX_ENTRIES_TO_ARCHIVE,omitempty"`
116119
}
117120

118121
// QuorumSetIsConfigured returns true if there is a quorum set defined in the configuration.

services/horizon/internal/test/integration/core_config.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ type validatorCoreConfigTemplatePrams struct {
55
NetworkPassphrase string
66
TestingMinimumPersistentEntryLifetime int
77
TestingSorobanHighLimitOverride bool
8+
OverrideEvictionParamsForTesting bool
9+
TestingStartingEvictionScanLevel uint
10+
TestingMaxEntriesToArchive uint
811
}
912

1013
type captiveCoreConfigTemplatePrams struct {
@@ -20,6 +23,12 @@ NETWORK_PASSPHRASE="{{ .NetworkPassphrase }}"
2023
TESTING_MINIMUM_PERSISTENT_ENTRY_LIFETIME={{ .TestingMinimumPersistentEntryLifetime }}
2124
TESTING_SOROBAN_HIGH_LIMIT_OVERRIDE={{ .TestingSorobanHighLimitOverride }}
2225
26+
{{if .OverrideEvictionParamsForTesting}}
27+
OVERRIDE_EVICTION_PARAMS_FOR_TESTING=true
28+
TESTING_MAX_ENTRIES_TO_ARCHIVE={{ .TestingMaxEntriesToArchive }}
29+
TESTING_STARTING_EVICTION_SCAN_LEVEL={{ .TestingStartingEvictionScanLevel }}
30+
{{end}}
31+
2332
PEER_PORT=11625
2433
HTTP_PORT=11626
2534
PUBLIC_HTTP_PORT=true
@@ -52,6 +61,12 @@ TESTING_MINIMUM_PERSISTENT_ENTRY_LIFETIME={{ .TestingMinimumPersistentEntryLifet
5261
TESTING_SOROBAN_HIGH_LIMIT_OVERRIDE={{ .TestingSorobanHighLimitOverride }}
5362
ENABLE_SOROBAN_DIAGNOSTIC_EVENTS=true
5463
64+
{{if .OverrideEvictionParamsForTesting}}
65+
OVERRIDE_EVICTION_PARAMS_FOR_TESTING=true
66+
TESTING_MAX_ENTRIES_TO_ARCHIVE={{ .TestingMaxEntriesToArchive }}
67+
TESTING_STARTING_EVICTION_SCAN_LEVEL={{ .TestingStartingEvictionScanLevel }}
68+
{{end}}
69+
5570
PEER_PORT=11725
5671
5772
UNSAFE_QUORUM=true

services/horizon/internal/test/integration/integration.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ type Config struct {
6868
StellarRPCDockerImage string
6969
SkipProtocolUpgrade bool
7070
QuickExpiration bool
71+
QuickEviction bool
7172
NetworkPassphrase string
7273

7374
// Weird naming here because bools default to false, but we want to start
@@ -166,11 +167,17 @@ func NewTest(t *testing.T, config Config) *Test {
166167
NetworkPassphrase: config.NetworkPassphrase,
167168
TestingMinimumPersistentEntryLifetime: 65536,
168169
TestingSorobanHighLimitOverride: false,
170+
OverrideEvictionParamsForTesting: false,
169171
}
170172
if config.QuickExpiration {
171173
validatorParams.TestingSorobanHighLimitOverride = true
172174
validatorParams.TestingMinimumPersistentEntryLifetime = 10
173175
}
176+
if config.QuickEviction {
177+
validatorParams.OverrideEvictionParamsForTesting = true
178+
validatorParams.TestingStartingEvictionScanLevel = 2
179+
validatorParams.TestingMaxEntriesToArchive = 100
180+
}
174181
var i *Test
175182
if !config.SkipCoreContainerCreation {
176183
composePath := findDockerComposePath()

0 commit comments

Comments
 (0)