mirror of
https://github.com/alexgo-io/stacks-puppet-node.git
synced 2026-04-14 12:06:42 +08:00
use blockstack_put_zonefile() to save zonefiles to atlas; update atlas network sim calls with working_dir
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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'])
|
||||
|
||||
Reference in New Issue
Block a user