Page MenuHomePhabricator

Added a script to test seeds
ClosedPublic

Authored by jasonbcox on Aug 6 2019, 19:01.

Details

Summary

We need an automateable way to test seeds. This script takes in nodes_<main|test>.txt and outputs peers that
it successfully connected to.

This script is useful for verifying that newly added seeds are viable.

This script may also be used to determine general "health" of the seeds list by calculating the fraction of nodes
that can be successfully connected to at any point in time:

TOTAL=$(cat nodes_main.txt | wc -l)
NUM=$(./test-seeds.sh < nodes_main.txt | wc -l)
echo "scale=3; $NUM / $TOTAL" | bc

With additional automation, the seeds could be updated automatically whenever the above fraction drops below
a certain threshold. More testing will be necessary to pick a sane number.

Test Plan

Assuming build is available at <project>/build:

cd contrib/seeds
./test-seeds.sh -h
./test-seeds.sh < nodes_main.txt
./test-seeds.sh --testnet < nodes_test.txt

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Fabien requested changes to this revision.Aug 7 2019, 08:54
Fabien added a subscriber: Fabien.
Fabien added inline comments.
contrib/seeds/test-seeds.sh
47 ↗(On Diff #10638)

You can check that the binaries exist before using them, that will allow for a better error message.

92 ↗(On Diff #10638)

You should consider some kind of wait_until() function to avoid all the sleeps and have a more reliable test.

This revision now requires changes to proceed.Aug 7 2019, 08:54

Fixed binaries checks and wait-for behavior

Fabien requested changes to this revision.Sep 9 2019, 06:26

A single nit repeated all over the script.
Otherwise it looks good to me, it proved itself useful at release time to determine from which source to gather the seeds.

contrib/seeds/test-seeds.sh
48 ↗(On Diff #10657)

Nit: ${BITCOIND} with braces.

52 ↗(On Diff #10657)

Dito.

57 ↗(On Diff #10657)

Dito.

58 ↗(On Diff #10657)

Dito.

74 ↗(On Diff #10657)

Dito.

77 ↗(On Diff #10657)

Dito.

86 ↗(On Diff #10657)

Dito.

87 ↗(On Diff #10657)

Dito.

92 ↗(On Diff #10657)

Dito.

95 ↗(On Diff #10657)

Dito.

99 ↗(On Diff #10657)

Dito.

101 ↗(On Diff #10657)

Dito.

105 ↗(On Diff #10657)

Dito.

107 ↗(On Diff #10657)

Dito.

112 ↗(On Diff #10657)

Dito.

117 ↗(On Diff #10657)

Dito.

119 ↗(On Diff #10657)

Dito.

This revision now requires changes to proceed.Sep 9 2019, 06:26
  • Fixed braces everywhere.
  • Rebased
  • Also fixed up the bash location and added copyright.
  • Fixed some lint errors.
Fabien requested changes to this revision.Sep 9 2019, 19:02
Fabien added inline comments.
contrib/seeds/test-seeds.sh
29 ↗(On Diff #11164)
110 ↗(On Diff #11164)

You can fix it by naming the variable _ (underscore).

This revision now requires changes to proceed.Sep 9 2019, 19:02

Fixes according to feedback

This revision is now accepted and ready to land.Sep 10 2019, 06:19
This revision was automatically updated to reflect the committed changes.