From ef384f516480687a258dc01bcf4554bf0ffb8f41 Mon Sep 17 00:00:00 2001 From: Jude Nelson Date: Tue, 16 Jan 2018 16:37:50 -0500 Subject: [PATCH] use blockstack_put_zonefile() to save zonefiles to atlas; update atlas network sim calls with working_dir --- .../scenarios/name_pre_reg_up_atlas_chain.py | 8 +++----- .../scenarios/name_pre_reg_up_atlas_churn.py | 8 +++----- .../scenarios/name_pre_reg_up_atlas_mesh.py | 8 +++----- .../scenarios/name_pre_reg_up_atlas_nat.py | 8 +++----- .../scenarios/name_pre_reg_up_atlas_storage.py | 11 +++++------ 5 files changed, 17 insertions(+), 26 deletions(-) diff --git a/integration_tests/blockstack_integration_tests/scenarios/name_pre_reg_up_atlas_chain.py b/integration_tests/blockstack_integration_tests/scenarios/name_pre_reg_up_atlas_chain.py index bf970aa59..93f0b2dd4 100644 --- a/integration_tests/blockstack_integration_tests/scenarios/name_pre_reg_up_atlas_chain.py +++ b/integration_tests/blockstack_integration_tests/scenarios/name_pre_reg_up_atlas_chain.py @@ -116,7 +116,7 @@ def scenario( wallets, **kw ): # drop otherwise return 1.0 - network_des = atlas_network.atlas_network_build( atlas_nodes, atlas_topology, {}, os.path.join( testlib.working_dir(**kw), "atlas_network" ) ) + network_des = atlas_network.atlas_network_build( testlib.working_dir(**kw), atlas_nodes, atlas_topology, {}, os.path.join( testlib.working_dir(**kw), "atlas_network" ) ) atlas_network.atlas_network_start( network_des, drop_probability=chain_drop ) print "Waiting 25 seconds for the altas peers to catch up" @@ -136,10 +136,8 @@ def scenario( wallets, **kw ): testlib.next_block( **kw ) - # propagate - res = testlib.blockstack_cli_sync_zonefile('foo_{}.test'.format(i), zonefile_string=empty_zonefile_str) - if 'error' in res: - print json.dumps(res) + res = testlib.blockstack_put_zonefile(empty_zonefile_str) + if not res: return False # wait at most 60 seconds for atlas network to converge diff --git a/integration_tests/blockstack_integration_tests/scenarios/name_pre_reg_up_atlas_churn.py b/integration_tests/blockstack_integration_tests/scenarios/name_pre_reg_up_atlas_churn.py index 761b219ab..44136ec06 100644 --- a/integration_tests/blockstack_integration_tests/scenarios/name_pre_reg_up_atlas_churn.py +++ b/integration_tests/blockstack_integration_tests/scenarios/name_pre_reg_up_atlas_churn.py @@ -106,10 +106,8 @@ def scenario( wallets, **kw ): testlib.next_block( **kw ) - # propagate - res = testlib.blockstack_cli_sync_zonefile('foo_{}.test'.format(i), zonefile_string=empty_zonefile_str) - if 'error' in res: - print json.dumps(res) + res = testlib.blockstack_put_zonefile(empty_zonefile_str) + if not res: return False # start up an atlas network with 16 peers, 8 of which will be active at once. @@ -155,7 +153,7 @@ def scenario( wallets, **kw ): return 0.0 - network_des = atlas_network.atlas_network_build( atlas_nodes, atlas_topology, {}, os.path.join( testlib.working_dir(**kw), "atlas_network" ) ) + network_des = atlas_network.atlas_network_build( testlib.working_dir(**kw), atlas_nodes, atlas_topology, {}, os.path.join( testlib.working_dir(**kw), "atlas_network" ) ) atlas_network.atlas_network_start( network_des, drop_probability=churn_drop ) print "Waiting 120 seconds for the altas peers to catch up" diff --git a/integration_tests/blockstack_integration_tests/scenarios/name_pre_reg_up_atlas_mesh.py b/integration_tests/blockstack_integration_tests/scenarios/name_pre_reg_up_atlas_mesh.py index 04c2e39a5..e35947403 100644 --- a/integration_tests/blockstack_integration_tests/scenarios/name_pre_reg_up_atlas_mesh.py +++ b/integration_tests/blockstack_integration_tests/scenarios/name_pre_reg_up_atlas_mesh.py @@ -106,10 +106,8 @@ def scenario( wallets, **kw ): testlib.next_block( **kw ) - # propagate - res = testlib.blockstack_cli_sync_zonefile('foo_{}.test'.format(i), zonefile_string=empty_zonefile_str) - if 'error' in res: - print json.dumps(res) + res = testlib.blockstack_put_zonefile(empty_zonefile_str) + if not res: return False # start up an Atlas test network with 9 nodes: the main one doing the test, and 8 subordinate ones that treat it as a seed peer. @@ -119,7 +117,7 @@ def scenario( wallets, **kw ): for node_port in atlas_nodes: atlas_topology[node_port] = [16264] - network_des = atlas_network.atlas_network_build( atlas_nodes, atlas_topology, {}, os.path.join( testlib.working_dir(**kw), "atlas_network" )) + network_des = atlas_network.atlas_network_build( testlib.working_dir(**kw), atlas_nodes, atlas_topology, {}, os.path.join( testlib.working_dir(**kw), "atlas_network" )) atlas_network.atlas_network_start( network_des ) print "Waiting 60 seconds for the altas peers to catch up" diff --git a/integration_tests/blockstack_integration_tests/scenarios/name_pre_reg_up_atlas_nat.py b/integration_tests/blockstack_integration_tests/scenarios/name_pre_reg_up_atlas_nat.py index 5e5ad4c09..648ab52b3 100644 --- a/integration_tests/blockstack_integration_tests/scenarios/name_pre_reg_up_atlas_nat.py +++ b/integration_tests/blockstack_integration_tests/scenarios/name_pre_reg_up_atlas_nat.py @@ -106,10 +106,8 @@ def scenario( wallets, **kw ): testlib.next_block( **kw ) - # propagate - res = testlib.blockstack_cli_sync_zonefile('foo_{}.test'.format(i), zonefile_string=empty_zonefile_str) - if 'error' in res: - print json.dumps(res) + res = testlib.blockstack_put_zonefile(empty_zonefile_str) + if not res: return False # start up an Atlas test network with 9 nodes: the main one doing the test, and 8 subordinate ones that treat it as a seed peer @@ -132,7 +130,7 @@ def scenario( wallets, **kw ): # connections to the seed node always succeed return 0.0 - network_des = atlas_network.atlas_network_build( atlas_nodes, atlas_topology, {}, os.path.join( testlib.working_dir(**kw), "atlas_network" ) ) + network_des = atlas_network.atlas_network_build( testlib.working_dir(**kw), atlas_nodes, atlas_topology, {}, os.path.join( testlib.working_dir(**kw), "atlas_network" ) ) atlas_network.atlas_network_start( network_des, drop_probability=nat_drop ) print "Waiting 60 seconds for the altas peers to catch up" diff --git a/integration_tests/blockstack_integration_tests/scenarios/name_pre_reg_up_atlas_storage.py b/integration_tests/blockstack_integration_tests/scenarios/name_pre_reg_up_atlas_storage.py index 618a03e58..efbe4a72b 100644 --- a/integration_tests/blockstack_integration_tests/scenarios/name_pre_reg_up_atlas_storage.py +++ b/integration_tests/blockstack_integration_tests/scenarios/name_pre_reg_up_atlas_storage.py @@ -117,15 +117,13 @@ def scenario( wallets, **kw ): testlib.next_block( **kw ) - # propagate - res = testlib.blockstack_cli_sync_zonefile('foo_{}.test'.format(i), zonefile_string=empty_zonefile_str) - if 'error' in res: - print json.dumps(res) + res = testlib.blockstack_put_zonefile(empty_zonefile_str) + if not res: return False # start up a simple Atlas test network with two nodes: the main one doing the test, and a subordinate one that treats it as a seed peer. atlas_dir = os.path.join( working_dir, "atlas_network" ) - network_des = atlas_network.atlas_network_build( [17000], {17000: [16264]}, {}, atlas_dir ) + network_des = atlas_network.atlas_network_build( testlib.working_dir(**kw), [17000], {17000: [16264]}, {}, atlas_dir ) atlas_network.atlas_network_start( network_des ) # wait at most 60 seconds for atlas network to converge @@ -197,6 +195,7 @@ def check( state_engine ): name = 'foo_{}.test'.format(i) value_hash = value_hashes[i] + ''' # atlas logic tried storage (either this node or the atlas peer) zfinfo = blockstack.atlasdb_get_zonefile( value_hash, path=atlasdb_path ) if not zfinfo['tried_storage']: @@ -205,7 +204,7 @@ def check( state_engine ): if not zfinfo2['tried_storage']: print "didn't get zonefile from storage: test node: %s, atlas peer: %s" % (zfinfo, zfinfo2) return False - + ''' ''' # zonefile stored to disk? zfdata = blockstack_client.zonefile.load_name_zonefile(name, value_hash, storage_drivers=['disk'])