Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

netdeploy: allow simple local net topologies #5612

Merged
merged 3 commits into from Jul 28, 2023

Conversation

algorandskiy
Copy link
Contributor

Summary

Changes to netdeploy to control local net topologies. Motivation is allow some networking tests on a local machine without spinning up a cluster.

Implementation Notes:

  1. Added PeerList property into local net templates
  2. Replaced TemplateFile with actual Template in deployed template network.json since the former was not used.
  3. Supported PeerList in network template start (goal network -r xxx start)

Test Plan

Added some unit test. Tested manually with FiveNodesTwoRelays.json templates that forces NPN to connect a single relay, and one of part nodes to connect to another single relay.

$ ps | grep algod
30090 ttys001    0:02.75 ~/go/bin/algod -d ~/networks/five-test/Relay1
30091 ttys001    0:02.91 ~/go/bin/algod -d ~/networks/five-test/Relay2 -p http://127.0.0.1:63606
30092 ttys001    0:02.90 ~/go/bin/algod -d ~/networks/five-test/NonPartNode -p http://127.0.0.1:63606
30093 ttys001    0:04.83 ~/go/bin/algod -d ~/networks/five-test/PartNode1 -p http://127.0.0.1:63606;http://127.0.0.1:63608
30094 ttys001    0:04.91 ~/go/bin/algod -d ~/networks/five-test/PartNode2 -p http://127.0.0.1:63608

NonPartNode connects only R1, PartNode1 connects to both, and PartNode2 connects only to R2 as the templates specifies:

        {
            "Name": "PartNode1",
            "Wallets": [{
                "Name": "LargeWallet",
                "ParticipationOnly": true
            }],
            "PeerList": "Relay1;Relay2"
        },
        {
            "Name": "PartNode2",
            "Wallets": [{
                "Name": "SmallWallet",
                "ParticipationOnly": true
            }],
            "PeerList": "Relay2"
        },
        {
            "Name": "NonPartNode",
            "PeerList": "Relay1"
        }

@algorandskiy algorandskiy self-assigned this Jul 26, 2023
@algorandskiy algorandskiy changed the title Pavel/local net topology netdeploy: allow simple local net topologies Jul 26, 2023
@codecov
Copy link

codecov bot commented Jul 26, 2023

Codecov Report

Merging #5612 (f70c373) into master (670010a) will decrease coverage by 0.05%.
Report is 1 commits behind head on master.
The diff coverage is 8.00%.

@@            Coverage Diff             @@
##           master    #5612      +/-   ##
==========================================
- Coverage   54.99%   54.94%   -0.05%     
==========================================
  Files         460      460              
  Lines       64439    64450      +11     
==========================================
- Hits        35436    35413      -23     
- Misses      26637    26665      +28     
- Partials     2366     2372       +6     
Files Changed Coverage Δ
netdeploy/network.go 9.29% <0.00%> (-0.33%) ⬇️
netdeploy/remote/nodeConfig.go 0.00% <ø> (ø)
netdeploy/networkTemplate.go 43.12% <100.00%> (+0.71%) ⬆️

... and 14 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Contributor

@winder winder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

netdeploy/network.go Show resolved Hide resolved
Copy link
Contributor

@AlgoAxel AlgoAxel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am trying to figure out why PeerList is treated as a semicolon delimited string instead of as a []string. But this does indeed work, and I am assuming there's a serialization need, so 👍

netdeploy/networkTemplate.go Show resolved Hide resolved
netdeploy/network.go Show resolved Hide resolved
@algorandskiy algorandskiy merged commit 021f0c3 into algorand:master Jul 28, 2023
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants