|
| 1 | +// Copyright 2019 Stellar Development Foundation and contributors. Licensed |
| 2 | +// under the Apache License, Version 2.0. See the COPYING file at the root |
| 3 | +// of this distribution or at http://www.apache.org/licenses/LICENSE-2.0 |
| 4 | + |
| 5 | +module MissionValidatorSetup |
| 6 | + |
| 7 | +open StellarCoreSet |
| 8 | +open StellarCorePeer |
| 9 | +open StellarMissionContext |
| 10 | +open StellarSupercluster |
| 11 | +open StellarFormation |
| 12 | +open StellarStatefulSets |
| 13 | +open StellarCoreHTTP |
| 14 | + |
| 15 | +// This mission creates a network with validator configurations that closely |
| 16 | +// mirror how tier 1 validators are actually configured. It uses both Postgres |
| 17 | +// and has history archives enabled. This is a smoke test that spins up the |
| 18 | +// network, runs for ~70 ledgers with load generation, verifies history |
| 19 | +// publishing works, then spins it down. |
| 20 | +let validatorSetup (context: MissionContext) = |
| 21 | + let opts = |
| 22 | + { CoreSetOptions.GetDefault context.image with |
| 23 | + dbType = Postgres |
| 24 | + // Use disk-backed storage like production validators |
| 25 | + emptyDirType = DiskBackedEmptyDir |
| 26 | + localHistory = true |
| 27 | + accelerateTime = true |
| 28 | + // Enable maintenance like production validators |
| 29 | + performMaintenance = true } |
| 30 | + |
| 31 | + let coreSet = MakeLiveCoreSet "core" opts |
| 32 | + |
| 33 | + let context = |
| 34 | + { context with |
| 35 | + numAccounts = 200 |
| 36 | + genesisTestAccountCount = Some(200) |
| 37 | + numTxs = 500 |
| 38 | + txRate = 10 } |
| 39 | + |
| 40 | + context.Execute |
| 41 | + [ coreSet ] |
| 42 | + None |
| 43 | + (fun (formation: StellarFormation) -> |
| 44 | + formation.WaitUntilSynced [ coreSet ] |
| 45 | + formation.UpgradeProtocolToLatest [ coreSet ] |
| 46 | + |
| 47 | + // Run load generation to ensure blocks aren't empty |
| 48 | + formation.RunLoadgen coreSet context.GeneratePaymentLoad |
| 49 | + |
| 50 | + // Wait for a few more ledgers to ensure publishing happens |
| 51 | + let peer = formation.NetworkCfg.GetPeer coreSet 0 |
| 52 | + peer.WaitForFewLedgers 20 |
| 53 | + |
| 54 | + if (peer.GetMetrics().HistoryPublishSuccess.Count = 0) then |
| 55 | + failwith "history.publish.success is 0, expected > 0") |
0 commit comments