Skip to content

Commit

Permalink
chore: final touches
Browse files Browse the repository at this point in the history
  • Loading branch information
evan-forbes committed Nov 17, 2023
1 parent 4a39b27 commit db0fdfd
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 33 deletions.
28 changes: 19 additions & 9 deletions test/testground/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Testground Experiement Tooling

## Flow
## Test Instance Communication and Experiment Flow

```go
// Role is the interface between a testground test entrypoint and the actual
Expand Down Expand Up @@ -87,15 +87,12 @@ sequenceDiagram
Per the diagram above, the leader node initializes and modifies the configs used
by each node. This allows for arbitrary network topologies to be created.

### Defining the Experiemnt
## Implemented Experiments

To run an specific type of experiment, specify the experiemnt in the `plan.toml`.
### Standard

```toml
experiment = "unbounded_block_size"
```

To create a new experiment.
The `standard` test runs an experiment that is as close to mainnet as possible.
This is used as a base for other experiements.

## Running the Experiment

Expand All @@ -107,11 +104,24 @@ testground plan import --from . --name celestia
testground daemon

# This command should be executed in the 2nd terminal
testground run composition -f compositions/unbounded-block-size/plan.toml --wait
testground run composition -f compositions/standard/plan.toml --wait
```

## Collecting Data

### Grafana

All metrics data is logged to a separate testground specific grafana/influx
node. To access that node, forward the ports use kubectl.

```sh
export POD_NAME=$(kubectl get pods --namespace default -l "app.kubernetes.io/name=grafana,app.kubernetes.io/instance=tg-monitoring" -o jsonpath="{.items[0].metadata.name}")

kubectl --namespace default port-forward $POD_NAME 3000

contact members of the devops team or testground admins to get the creds for accessing this node.
```

### Tracing

The tracing infrastructure in celestia-core can be used by using `tracing_nodes`
Expand Down
8 changes: 4 additions & 4 deletions test/testground/compositions/standard/plan.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ runner = "cluster:k8s"
disable_metrics = false

[global.run.test_params]
chain_id = "debug-8MB-4"
chain_id = "standard-x"
timeout = "25m"
halt_height = "50"
latency = "0"
bandwidth = "1Gib"
validators = "40"
topology = "connect_random"
topology = "seed"
pex = "true"
timeout_propose = "13s"
timeout_commit = "2s"
timeout_propose = "10s"
timeout_commit = "11s"
per_peer_bandwidth = "5Mib"
blob_sequences = "2"
blob_sizes = "130000"
Expand Down
2 changes: 1 addition & 1 deletion test/testground/manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ timeout_propose = { type = "string", default = "10s" }
timeout_commit = { type = "string", default = "11s" }
halt_height = { type = "int", default = 50 }
pex = { type = "bool", default = true }
topology = { type = "string", default = "connect_all" }
topology = { type = "string", default = "seed" }
blob_sequences = { type = "int", default = 10 }
blob_sizes = { type = "int", default = 100000 }
blobs_per_sequence = { type = "int", default = 1 }
Expand Down
18 changes: 10 additions & 8 deletions test/testground/network/command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"testing"
"time"

"github.com/celestiaorg/celestia-app/app"
"github.com/stretchr/testify/require"
"github.com/tendermint/tendermint/p2p/pex"
"github.com/testground/sdk-go/run"
Expand Down Expand Up @@ -90,16 +91,17 @@ func TestAddrBookLoading(t *testing.T) {
}
temp := t.TempDir()

err := addPeersToAddressBook(temp, []PeerPacket{peerPacket})
tmcfg := app.DefaultConsensusConfig()
tmcfg = tmcfg.SetRoot(temp)

fmt.Println(tmcfg.P2P.AddrBookFile(), temp)

err := addPeersToAddressBook(tmcfg.P2P.AddrBookFile(), []PeerPacket{peerPacket})
require.NoError(t, err)

addrBook := pex.NewAddrBook(temp+"/addrbook.json", false)
addrBook := pex.NewAddrBook(tmcfg.P2P.AddrBookFile(), false)
addrBook.OnStart()
s := addrBook.GetSelection()
ss := make([]string, 0, len(s))
for _, addr := range s {
ss = append(ss, addr.String())
}

fmt.Println(ss, addrBook.Empty())
require.False(t, addrBook.Empty())
require.Equal(t, addrBook.Size(), 1)
}
13 changes: 4 additions & 9 deletions test/testground/network/consensus_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"path/filepath"
"regexp"
"strconv"
"strings"

"github.com/celestiaorg/celestia-app/app"
"github.com/celestiaorg/celestia-app/app/encoding"
Expand Down Expand Up @@ -263,20 +264,16 @@ func getPublicKeys(kr keyring.Keyring, accounts ...string) ([]string, error) {
}

func addPeersToAddressBook(path string, peers []PeerPacket) error {
var filePath string = fmt.Sprintf("%s/config/addrbook.json", path)

err := os.MkdirAll(path+"/config", os.ModePerm)
err := os.MkdirAll(strings.Replace(path, "addrbook.json", "", -1), os.ModePerm)
if err != nil {
return err
}

f, err := os.Create(filePath)
addrBook := pex.NewAddrBook(path, false)
err = addrBook.OnStart()
if err != nil {
return err
}
defer f.Close()

addrBook := pex.NewAddrBook(filePath, false)

for _, peer := range peers {
id, ip, port, err := parsePeerID(peer.PeerID)
Expand All @@ -290,8 +287,6 @@ func addPeersToAddressBook(path string, peers []PeerPacket) error {
Port: uint16(port),
}

fmt.Println("routable", netAddr.Routable())

err = addrBook.AddAddress(&netAddr, &netAddr)
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion test/testground/network/follower.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func (f *Follower) Plan(ctx context.Context, runenv *runtime.RunEnv, initCtx *ru
return err
}

err = addPeersToAddressBook(homeDir, packets)
err = addPeersToAddressBook(f.CmtConfig.P2P.AddrBookFile(), packets)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion test/testground/network/leader.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func (l *Leader) Plan(ctx context.Context, runenv *runtime.RunEnv, initCtx *run.
return err
}

err = addPeersToAddressBook(homeDir, packets)
err = addPeersToAddressBook(l.CmtConfig.P2P.AddrBookFile(), packets)
if err != nil {
return err
}
Expand Down

0 comments on commit db0fdfd

Please sign in to comment.