-
Notifications
You must be signed in to change notification settings - Fork 493
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
Recipe for network testing #1322
Merged
algojohnlee
merged 22 commits into
algorand:master
from
egieseke:eric/network-upgrade-test
Sep 3, 2020
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
fecd331
Merge branch 'master' of https://github.com/algorand/go-algorand
egieseke 9ab1df3
Merge branch 'master' of https://github.com/algorand/go-algorand
egieseke 8206f27
Merge branch 'master' of https://github.com/algorand/go-algorand
egieseke 39fe517
Merge branch 'master' of https://github.com/algorand/go-algorand
egieseke 58c0d37
Merge branch 'master' of https://github.com/algorand/go-algorand
egieseke 9460f61
Merge branch 'master' of https://github.com/algorand/go-algorand
egieseke 5291d9d
Merge branch 'master' of https://github.com/algorand/go-algorand
egieseke 7e07bdd
Merge branch 'master' of https://github.com/algorand/go-algorand
egieseke 10930c0
Merge branch 'master' of https://github.com/algorand/go-algorand
egieseke 06f244f
Merge branch 'master' of https://github.com/algorand/go-algorand
egieseke a8cd1c1
Merge branch 'master' of https://github.com/algorand/go-algorand
egieseke 436f021
Added recipe for network disruption testing. Updated gen_toplogy.py …
egieseke 7bd4e2f
Created network-partion recipe with gen_topology.py to support group …
egieseke fff127d
Updated random number limits and fixed regions array.
egieseke 5ed966d
Added generation of group files to specify nodes in each group.
egieseke 1be4260
Adjust docker/build/Docker-deploy GOPROXY environment var to single p…
egieseke 7b4fdf8
Update gen_topology.py script to exit on error.
egieseke df75603
Removed commented code and added comments.
egieseke 58bbaa4
Removed default group name. Now defaults to "".
egieseke ebbdb4d
Removed extra white space.
egieseke 552139d
Added back multipath GOPROXY setting since we will upgrade to
egieseke 7dc1ab2
Removed extra whitespace.
egieseke File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 |
---|---|---|
|
@@ -23,6 +23,7 @@ import ( | |
|
||
type cloudHostType struct { | ||
Name string | ||
Group string | ||
Template string | ||
} | ||
|
||
|
12 changes: 12 additions & 0 deletions
12
test/testdata/deployednettemplates/recipes/network-partition/Makefile
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,12 @@ | ||
PARAMS=-w 100 -R 8 -N 20 -n 100 -H 10 --node-template node.json --relay-template relay.json --non-participating-node-template nonPartNode.json | ||
|
||
all: net.json genesis.json | ||
|
||
net.json: node.json nonPartNode.json ${GOPATH}/bin/netgoal | ||
netgoal generate -t net -r /tmp/wat -o net.json ${PARAMS} | ||
|
||
genesis.json: ${GOPATH}/bin/netgoal | ||
netgoal generate -t genesis -r /tmp/wat -o genesis.json ${PARAMS} | ||
|
||
clean: | ||
rm -f net.json genesis.json |
71 changes: 71 additions & 0 deletions
71
test/testdata/deployednettemplates/recipes/network-partition/gen_topology.py
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,71 @@ | ||
import random | ||
|
||
node_types = {"R":8, "N":20, "NPN":2} | ||
node_size = {"R":"-m5d.4xl", "N":"-m5d.4xl", "NPN":"-m5d.4xl"} | ||
partitions = {"A":50, "B":20, "C":10, "D":10, "E":5, "F":5} | ||
regions = [ | ||
"AWS-US-EAST-2", | ||
"AWS-US-WEST-1" | ||
] | ||
|
||
def gen_topology(ranges): | ||
f = open("topology.json", "w") | ||
f.write("{ \"Hosts\":\n [") | ||
node_groups = {} | ||
|
||
region_count = len(regions) | ||
first = True | ||
for x in node_types: | ||
node_type = x | ||
node_count = node_types[x] | ||
region_size = node_size[x] | ||
for i in range(node_count): | ||
node_name = node_type + str(i+1) | ||
region = regions[i%region_count] | ||
# randomly assign the node to a partition | ||
partition = get_partition(ranges) | ||
node_groups.setdefault(partition,[]).append(node_name); | ||
if (first ): | ||
first = False | ||
else: | ||
f.write(",") | ||
f.write ("\n {\n \"Name\": \"" + node_name + "\",\n \"Group\": \"" + partition + "\",\n \"Template\": \"" + region + region_size + "\"\n }" ) | ||
|
||
f.write("\n ]\n}\n") | ||
f.close() | ||
|
||
for node_group in node_groups: | ||
f = open("group_" + node_group + ".txt", "w") | ||
for node in node_groups[node_group]: | ||
f.write(node +"\n") | ||
f.close() | ||
|
||
|
||
def get_partition(ranges): | ||
random_value = random.randint(1,100) | ||
for partition_name in ranges: | ||
partition_value = ranges[partition_name] | ||
if random_value >= partition_value['start'] and random_value <= partition_value['end'] : | ||
return partition_name | ||
print("error, partition not found for random_value ", random_value) | ||
exit(1) | ||
|
||
def get_ranges(): | ||
ranges = {} | ||
start_pos = 1; | ||
for name, size in partitions.items(): | ||
if (start_pos > 100) : | ||
print("error, range exceeded 100") | ||
exit(1) | ||
end_pos = start_pos + size - 1 | ||
ranges[name] = {"start": start_pos, "end": end_pos} | ||
start_pos = end_pos + 1 | ||
print(ranges) | ||
return ranges | ||
|
||
|
||
# create the group ranges based on group percent size | ||
ranges = get_ranges() | ||
|
||
# gen the topology.json file based and assign groups | ||
gen_topology(ranges) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need such a big network to conduct a partitioning test ?
I don't really see how the large network would help us getting the answer "does the network recover after partitioning? and after how long ?"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can adjust the network to be smaller. The github tickets ask for all 3 scenarios.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's true. It's that I just don't want you to get delayed by "deployment issues" that aren't related to the actual test you're trying to conduct.. Having the feedback that it's broken on small network is more valuable than the fact the it's broken on a large network ( and would probably be easier to evaluate )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, we will start testing tomorrow.