Browse Source

e2e: more reliable method for selecting node to inject evidence (#6880)

In retrospect my previous implementation of this node, could get
unlucky and never find the correct node. This method is more reliable.
pull/6882/head
Sam Kleinman 3 years ago
committed by GitHub
parent
commit
7169d26ddf
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions
  1. +3
    -2
      test/e2e/runner/evidence.go

+ 3
- 2
test/e2e/runner/evidence.go View File

@ -32,8 +32,9 @@ func InjectEvidence(testnet *e2e.Testnet, amount int) error {
// select a random node
var targetNode *e2e.Node
for i := 0; i < len(testnet.Nodes)-1; i++ {
targetNode = testnet.Nodes[rand.Intn(len(testnet.Nodes))] // nolint: gosec
for _, idx := range rand.Perm(len(testnet.Nodes)) {
targetNode = testnet.Nodes[idx]
if targetNode.Mode == e2e.ModeSeed {
targetNode = nil
continue


Loading…
Cancel
Save