-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
generic test plan scaffolding, with baseline plan (#39)
* test plan scaffolding * generify the testplan role dispatch * manifest.toml * initial go.mod and go.sum * correct name * gomod: update from build * node construction in scaffolding * fix test runner return type * remove offending comments * add initial composition, and fix context bug * debug lines * check errors from node construction * specify Repo after Online option * add power/proof type initialization code * fix baseline composition * use new docker-images (build/run) introduced in the #48 PR * upgrade go-sdk to master (#51) * fix types for run.InvokeMap * fix miner actor sequence address * explictly specify listen address for nodes on the data network * make a separate full node for the miner * initialize the wallet for the full node before creating the storage node * go mod tidy * also set the listen address for the miner node * circleci to build the soup testplan * extract topics * test runner: pass the role map to doRun for generic runner * use a wrapper TestEnvironment to encapsulate the runenv and initCtx * embed RunEnv and InitContext into TestEnvironment for better ergonomics * remove empty import * extract stateReady Co-authored-by: Anton Evangelatov <[email protected]>
- Loading branch information
Showing
9 changed files
with
2,587 additions
and
0 deletions.
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
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 @@ | ||
lotus-soup |
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,64 @@ | ||
package main | ||
|
||
// This is the basline test; Filecoin 101. | ||
// | ||
// A network with a bootstrapper, a number of miners, and a number of clients/full nodes | ||
// is constructed and connected through the bootstrapper. | ||
// Some funds are allocated to each node and a number of sectors are presealed in the genesis block. | ||
// | ||
// The test plan: | ||
// One or more clients store content to one or more miners, testing storage deals. | ||
// The plan ensures that the storage deals hit the blockchain and measure the time it took. | ||
// Verification: one or more clients retrieve and verify the hashes of stored content. | ||
// The plan ensures that all (previously) published content can be correctly retrieved | ||
// and measures the time it took. | ||
// | ||
// Preparation of the genesis block: this is the responsibility of the bootstrapper. | ||
// In order to compute the genesis block, we need to collect identities and presealed | ||
// sectors from each node. | ||
// The we create a genesis block that allocates some funds to each node and collects | ||
// the presealed sectors. | ||
var baselineRoles = map[string]func(*TestEnvironment) error{ | ||
"bootstrapper": runBaselineBootstrapper, | ||
"miner": runBaselineMiner, | ||
"client": runBaselineClient, | ||
} | ||
|
||
func runBaselineBootstrapper(t *TestEnvironment) error { | ||
t.RecordMessage("running bootstrapper") | ||
_, err := prepareBootstrapper(t) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
// TODO just wait until completion of test, nothing else to do | ||
|
||
return nil | ||
} | ||
|
||
func runBaselineMiner(t *TestEnvironment) error { | ||
t.RecordMessage("running miner") | ||
_, err := prepareMiner(t) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
// TODO wait a bit for network to bootstrap | ||
// TODO just wait until completion of test, serving requests -- the client does all the job | ||
|
||
return nil | ||
} | ||
|
||
func runBaselineClient(t *TestEnvironment) error { | ||
t.RecordMessage("running client") | ||
_, err := prepareClient(t) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
// TODO generate a number of random "files" and publish them to one or more miners | ||
// TODO broadcast published content CIDs to other clients | ||
// TODO select a random piece of content published by some other client and retreieve it | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
[metadata] | ||
name = "lotus-soup" | ||
author = "" | ||
|
||
[global] | ||
plan = "lotus-soup" | ||
case = "lotus-baseline" | ||
total_instances = 3 | ||
builder = "docker:go" | ||
runner = "local:docker" | ||
|
||
[[groups]] | ||
id = "bootstrapper" | ||
[groups.resources] | ||
memory = "120Mi" | ||
cpu = "10m" | ||
[groups.instances] | ||
count = 1 | ||
percentage = 0.0 | ||
[groups.run] | ||
[groups.run.test_params] | ||
role = "bootstrapper" | ||
clients = "1" | ||
miners = "1" | ||
balance = "2000" | ||
sectors = "10" | ||
|
||
[[groups]] | ||
id = "miners" | ||
[groups.resources] | ||
memory = "120Mi" | ||
cpu = "10m" | ||
[groups.instances] | ||
count = 1 | ||
percentage = 0.0 | ||
[groups.run] | ||
[groups.run.test_params] | ||
role = "miner" | ||
clients = "1" | ||
miners = "1" | ||
balance = "2000" | ||
sectors = "10" | ||
|
||
[[groups]] | ||
id = "clients" | ||
[groups.resources] | ||
memory = "120Mi" | ||
cpu = "10m" | ||
[groups.instances] | ||
count = 1 | ||
percentage = 0.0 | ||
[groups.run] | ||
[groups.run.test_params] | ||
role = "client" | ||
clients = "1" | ||
miners = "1" | ||
balance = "2000" | ||
sectors = "10" |
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,20 @@ | ||
module github.com/filecoin-project/oni/lotus-soup | ||
|
||
go 1.14 | ||
|
||
require ( | ||
github.com/filecoin-project/go-address v0.0.2-0.20200504173055-8b6f2fb2b3ef | ||
github.com/filecoin-project/go-storedcounter v0.0.0-20200421200003-1c99c62e8a5b | ||
github.com/filecoin-project/lotus v0.4.1-0.20200623104442-68d38eff33e4 | ||
github.com/filecoin-project/specs-actors v0.6.2-0.20200617175406-de392ca14121 | ||
github.com/ipfs/go-datastore v0.4.4 | ||
github.com/ipfs/go-log/v2 v2.1.2-0.20200609205458-f8d20c392cb7 | ||
github.com/libp2p/go-libp2p-core v0.6.0 | ||
github.com/multiformats/go-multiaddr v0.2.2 | ||
github.com/testground/sdk-go v0.2.3-0.20200617132925-2e4d69f9ba38 | ||
) | ||
|
||
// This will work in all build modes: docker:go, exec:go, and local go build. | ||
// On docker:go and exec:go, it maps to /extra/filecoin-ffi, as it's picked up | ||
// as an "extra source" in the manifest. | ||
replace github.com/filecoin-project/filecoin-ffi => ../extra/filecoin-ffi |
Large diffs are not rendered by default.
Oops, something went wrong.
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,27 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/testground/sdk-go/run" | ||
"github.com/testground/sdk-go/runtime" | ||
) | ||
|
||
var testplans = map[string]interface{}{ | ||
"lotus-baseline": doRun(baselineRoles), | ||
} | ||
|
||
func main() { | ||
run.InvokeMap(testplans) | ||
} | ||
|
||
func doRun(roles map[string]func(*TestEnvironment) error) run.InitializedTestCaseFn { | ||
return func(runenv *runtime.RunEnv, initCtx *run.InitContext) error { | ||
role := runenv.StringParam("role") | ||
proc, ok := baselineRoles[role] | ||
if ok { | ||
return proc(&TestEnvironment{RunEnv: runenv, InitContext: initCtx}) | ||
} | ||
return fmt.Errorf("Unknown role: %s", role) | ||
} | ||
} |
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,30 @@ | ||
name = "lotus-soup" | ||
extra_sources = { "exec:go" = ["../extra/filecoin-ffi"] } | ||
|
||
[defaults] | ||
builder = "docker:go" | ||
runner = "local:docker" | ||
|
||
[builders."docker:go"] | ||
enabled = true | ||
build_base_image = "iptestground/oni-buildbase:v1" | ||
runtime_image = "iptestground/oni-runtime:v1" | ||
enable_go_build_cache = true | ||
skip_runtime_image = false | ||
|
||
[runners."local:docker"] | ||
enabled = true | ||
|
||
[runners."cluster:k8s"] | ||
enabled = true | ||
|
||
[[testcases]] | ||
name = "lotus-baseline" | ||
instances = { min = 1, max = 100, default = 5 } | ||
|
||
[testcases.params] | ||
clients = { type = "int", default = 1 } | ||
miners = { type = "int", default = 1 } | ||
balance = { type = "int", default = 1 } | ||
sectors = { type = "int", default = 1 } | ||
role = { type = "string" } |
Oops, something went wrong.