-
Notifications
You must be signed in to change notification settings - Fork 293
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test(e2e benchmark): refactors E2EThroughput #3395
Merged
Merged
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
35cacc5
defines config options
staheri14 b1d6861
adds configOpts parameter to the Init func
staheri14 eb5d379
extends Setup parameter with config options
staheri14 f4c81f7
passes options through setup method
staheri14 c4e0b3b
allows passing genesis modifiers and consensus parameters in the test…
staheri14 ed1fddf
adds manifest struct
staheri14 cb63664
defines BenchTest
staheri14 05ecc53
make consensus params effective
staheri14 80c26e9
fixes getConsensusParams
staheri14 9af78d7
fixxes set consensus parameters by calling it after tesnet initiation
staheri14 94f8ef0
makes txsim image creation faster
staheri14 b4ae352
fixes changes to the order of AddFolder and Commit
staheri14 bd9fe31
obtains parameters from manifest
staheri14 8fd5d1f
reads txClient pars from manifest
staheri14 425b98f
fixes stale comments
staheri14 dd96cdc
removes private methods
staheri14 a944670
fixes linter issues
staheri14 4e26505
gets the remainder of the test parameters from the manifest
staheri14 25f4026
some reordering and refactoring
staheri14 2a978b8
Merge remote-tracking branch 'origin/main' into sanaz/manifest-first-…
staheri14 fe832f3
refactors the code
staheri14 e1a6e2d
resolves linter issues and returns error from benchTest methods
staheri14 c1e7d86
removes early return
staheri14 976ddca
Merge remote-tracking branch 'origin/main' into sanaz/refactor-E2EThr…
staheri14 4ed25aa
defines a separate go file for the BenchTest type and methods
staheri14 c2c7dfa
moves manifest to the benchmark package
staheri14 b2ac5f3
refactors the code to rename bench to benchmark
staheri14 193efd9
replaces txsim with txclient
staheri14 fac0034
Merge remote-tracking branch 'origin/main' into sanaz/refactor-E2EThr…
staheri14 db224b8
removes a redundant word
staheri14 e94ae4d
adds godoc for the BenchmarkTest methods
staheri14 a45e048
deletes old manifest file under the testnet package
staheri14 15b200c
fixes chain ID
staheri14 62a8781
addresses comments
staheri14 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"log" | ||
"time" | ||
|
||
"github.com/celestiaorg/celestia-app/v2/test/e2e/testnet" | ||
) | ||
|
||
type BenchmarkTest struct { | ||
*testnet.Testnet | ||
manifest *Manifest | ||
} | ||
|
||
func NewBenchmarkTest(name string, manifest *Manifest) (*BenchmarkTest, error) { | ||
// create a new testnet | ||
testNet, err := testnet.New(name, seed, | ||
testnet.GetGrafanaInfoFromEnvVar(), manifest.ChainID, | ||
manifest.GetGenesisModifiers()...) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
testNet.SetConsensusParams(manifest.GetConsensusParams()) | ||
return &BenchmarkTest{Testnet: testNet, manifest: manifest}, nil | ||
} | ||
|
||
// SetupNodes creates genesis nodes and tx clients based on the manifest. | ||
// There will be manifest.Validators validators and manifest.TxClients tx clients. | ||
// Each tx client connects to one validator. If TxClients are fewer than Validators, some validators will not have a tx client. | ||
func (b *BenchmarkTest) SetupNodes() error { | ||
testnet.NoError("failed to create genesis nodes", | ||
b.CreateGenesisNodes(b.manifest.Validators, | ||
b.manifest.CelestiaAppVersion, b.manifest.SelfDelegation, | ||
b.manifest.UpgradeHeight, b.manifest.ValidatorResource)) | ||
|
||
// obtain the GRPC endpoints of the validators | ||
gRPCEndpoints, err := b.RemoteGRPCEndpoints() | ||
testnet.NoError("failed to get validators GRPC endpoints", err) | ||
log.Println("validators GRPC endpoints", gRPCEndpoints) | ||
|
||
// create tx clients and point them to the validators | ||
log.Println("Creating tx clients") | ||
|
||
err = b.CreateTxClients(b.manifest.TxClientVersion, | ||
b.manifest.BlobSequences, | ||
b.manifest.BlobSizes, | ||
b.manifest.TxClientsResource, gRPCEndpoints) | ||
testnet.NoError("failed to create tx clients", err) | ||
|
||
// set up the testnet | ||
log.Println("Setting up testnet") | ||
testnet.NoError("failed to setup testnet", b.Setup( | ||
testnet.WithPerPeerBandwidth(b.manifest.PerPeerBandwidth), | ||
testnet.WithTimeoutPropose(b.manifest.TimeoutPropose), | ||
testnet.WithTimeoutCommit(b.manifest.TimeoutCommit), | ||
testnet.WithPrometheus(b.manifest.Prometheus), | ||
)) | ||
return nil | ||
} | ||
|
||
// Run runs the benchmark test for the specified duration in the manifest. | ||
func (b *BenchmarkTest) Run() error { | ||
log.Println("Starting testnet") | ||
err := b.Start() | ||
if err != nil { | ||
return fmt.Errorf("failed to start testnet: %v", err) | ||
} | ||
|
||
// once the testnet is up, start tx clients | ||
log.Println("Starting tx clients") | ||
err = b.StartTxClients() | ||
if err != nil { | ||
return fmt.Errorf("failed to start tx clients: %v", err) | ||
} | ||
|
||
// wait some time for the tx clients to submit transactions | ||
time.Sleep(b.manifest.TestDuration) | ||
|
||
return nil | ||
} |
This file contains 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
This file contains 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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use of
context.Background()
inReadBlockchain
might not be ideal for all scenarios. Consider passing a context that can be controlled externally.Committable suggestion