Skip to content

Simplify creation of test clients #27

Closed

Description

@tzdybal

Currently, in p2p package, clients in tests are created in very manual way. This generates a lot of code repetitions and is error prone.

It would be nice to simplify creation set/network of peers.

Example/proposed pseudo-code:

// nClients is a number of clients to generate
// connections is a map defining seed nodes for client.
//  - key is client index (from 0 to nClients-1).
//  - value is a list of seed nodes
func CreateNetwork(nClients int, connections map[int][]int, logger log.Logger) []*Client {
    keys, ids := createKeysAndIds(nClients)
    configs := createConfiguration(nClients, connections, logger)
    return buildClients(keys, configs, logger)
}

Activity

  1. added
    good first issue
    C:p2p
    T:testing
    on Mar 19, 2021
  2. self-assigned this
    on Mar 23, 2021
  3. tzdybal commented on Mar 23, 2021

    @tzdybal
    ContributorAuthor

    Resolved by #30.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

C:p2pT:testinggood first issue

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions