rename testkit.{Run=>Handle}DefaultRole.

This commit is contained in:
Raúl Kripalani 2020-07-01 14:53:34 +01:00
parent 81f8451a23
commit e5d6751b09
2 changed files with 7 additions and 5 deletions

View File

@ -41,9 +41,9 @@ func main() {
// Then we create a genesis block that allocates some funds to each node and collects // Then we create a genesis block that allocates some funds to each node and collects
// the presealed sectors. // the presealed sectors.
func dealsE2E(t *testkit.TestEnvironment) error { func dealsE2E(t *testkit.TestEnvironment) error {
// Dispatch non-client roles to defaults. // Dispatch/forward non-client roles to defaults.
if t.Role != "client" { if t.Role != "client" {
return testkit.RunDefaultRole(t) return testkit.HandleDefaultRole(t)
} }
cl, err := testkit.PrepareClient(t) cl, err := testkit.PrepareClient(t)

View File

@ -42,9 +42,11 @@ var DefaultRoles = map[RoleName]func(*TestEnvironment) error{
}, },
} }
// RunDefaultRole runs a default role, extracted from the `role` RunEnv // HandleDefaultRole handles a role by running its default behaviour.
// parameter. //
func RunDefaultRole(t *TestEnvironment) error { // This function is suitable to forward to when a test case doesn't need to
// explicitly handle/alter a role.
func HandleDefaultRole(t *TestEnvironment) error {
f, ok := DefaultRoles[t.Role] f, ok := DefaultRoles[t.Role]
if !ok { if !ok {
panic(fmt.Sprintf("unrecognized role: %s", t.Role)) panic(fmt.Sprintf("unrecognized role: %s", t.Role))