mirror of
https://github.com/alexgo-io/stacks-puppet-node.git
synced 2026-04-16 22:18:53 +08:00
Merge branch 'fix-integration-tests' into subdomain
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
uwsgi_cache_path /tmp/blockstack_uwsgi_cache levels=1:2 keys_zone=api:50m;
|
||||
uwsgi_cache_path /tmp/blockstack_uwsgi_cache levels=1:2 keys_zone=api:50m inactive=180m;
|
||||
|
||||
server {
|
||||
listen 80 default_server;
|
||||
server_name localhost;
|
||||
return 301 https://core.blockstack.org$request_uri;
|
||||
|
||||
|
||||
location / {
|
||||
include uwsgi_params;
|
||||
uwsgi_pass unix:/path/to/nginx/blockstack_api.sock;
|
||||
@@ -20,19 +20,23 @@ server {
|
||||
ssl_certificate_key /path/to/cert/privkey.pem;
|
||||
|
||||
location / {
|
||||
if ($request_method = OPTIONS ) {
|
||||
add_header Access-Control-Allow-Origin "*";
|
||||
add_header Access-Control-Allow-Methods "GET, HEAD, POST, OPTIONS";
|
||||
add_header Access-Control-Max-Age "21600";
|
||||
add_header Content-Length 0;
|
||||
add_header Content-Type text/plain;
|
||||
return 200;
|
||||
}
|
||||
|
||||
include uwsgi_params;
|
||||
uwsgi_pass unix:/tmp/blockstack_api.sock;
|
||||
|
||||
# expires 5m;
|
||||
|
||||
uwsgi_cache api;
|
||||
uwsgi_cache_key $uri$args;
|
||||
|
||||
add_header X-Cache-Status $upstream_cache_status;
|
||||
|
||||
uwsgi_cache_methods GET HEAD;
|
||||
|
||||
uwsgi_cache_valid 200 12h;
|
||||
uwsgi_cache_valid 404 12h;
|
||||
expires 180m;
|
||||
|
||||
uwsgi_cache api; uwsgi_cache_key $uri$args;
|
||||
add_header X-Cache-Status $upstream_cache_status;
|
||||
uwsgi_cache_methods GET HEAD;
|
||||
uwsgi_cache_valid 200 12h; uwsgi_cache_valid 404 12h;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -254,13 +254,13 @@ def scenario( wallets, **kw ):
|
||||
return False
|
||||
|
||||
# get the latest zonefile
|
||||
res = testlib.blockstack_REST_call("GET", "/v1/names/bar.test/zonefile/{}".format(last_zonefile_hash), ses )
|
||||
res = testlib.blockstack_REST_call("GET", "/v1/names/bar.test/zonefile/{}?raw=1".format(last_zonefile_hash), ses )
|
||||
if 'error' in res or res['http_status'] != 200:
|
||||
res['test'] = 'Failed to get last zonefile'
|
||||
print json.dumps(res)
|
||||
return False
|
||||
|
||||
if res['response']['zonefile'] != 'hello world':
|
||||
if res['raw'] != 'hello world':
|
||||
res['test'] = 'Failed to set zonefile data'
|
||||
print json.dumps(res)
|
||||
return False
|
||||
|
||||
@@ -225,13 +225,13 @@ def scenario( wallets, **kw ):
|
||||
for i in xrange(0, 6):
|
||||
testlib.next_block( **kw )
|
||||
|
||||
res = testlib.blockstack_REST_call("GET", "/v1/names/bar.test/zonefile/", ses )
|
||||
res = testlib.blockstack_REST_call("GET", "/v1/names/bar.test/zonefile/?raw=1", ses )
|
||||
if 'error' in res or res['http_status'] != 200:
|
||||
res['test'] = 'Failed to get name zonefile'
|
||||
print json.dumps(res)
|
||||
return False
|
||||
|
||||
if res['response']['zonefile'] != zf_str:
|
||||
if res['raw'] != zf_str:
|
||||
print "Zonefile wasn't updated."
|
||||
print "Expected: {}".format(zf_str)
|
||||
print "Received: {}".format(res['response']['zonefile'])
|
||||
|
||||
@@ -127,9 +127,7 @@ def scenario( wallets, **kw ):
|
||||
|
||||
# stop endpoint
|
||||
print >> sys.stderr, "\nstopping RPC daemon\n"
|
||||
config_dir = os.path.dirname(test_proxy.config_path)
|
||||
|
||||
blockstack_client.rpc.local_api_stop(config_dir=config_dir)
|
||||
testlib.stop_api()
|
||||
time.sleep(3)
|
||||
|
||||
# store to queue
|
||||
|
||||
@@ -494,7 +494,7 @@ def blockstack_client_initialize_wallet( password, payment_privkey, owner_privke
|
||||
|
||||
print "\nstopping API daemon\n"
|
||||
|
||||
res = blockstack_client.rpc.local_api_stop(config_dir=config_dir)
|
||||
res = hard_local_api_stop(config_dir=config_dir)
|
||||
|
||||
print "\nstarting API daemon\n"
|
||||
|
||||
@@ -2461,7 +2461,7 @@ def start_api(password):
|
||||
port = int(conf['api_endpoint_port'])
|
||||
api_pass = conf['api_password']
|
||||
|
||||
res = blockstack_client.rpc.local_api_stop(config_dir=config_dir)
|
||||
hard_local_api_stop(config_dir=config_dir)
|
||||
|
||||
res = blockstack_client.rpc.local_api_start(api_pass=api_pass, port=port, config_dir=config_dir, password=password)
|
||||
if not res:
|
||||
@@ -2483,13 +2483,35 @@ def stop_api():
|
||||
port = int(conf['api_endpoint_port'])
|
||||
api_pass = conf['api_password']
|
||||
|
||||
res = blockstack_client.rpc.local_api_stop(config_dir=config_dir)
|
||||
res = hard_local_api_stop(config_dir)
|
||||
if not res:
|
||||
return {'error': 'Failed to stop API server'}
|
||||
|
||||
return {'status': True}
|
||||
|
||||
|
||||
def hard_local_api_stop(config_dir):
|
||||
pidpath = blockstack_client.rpc.local_api_pidfile_path(
|
||||
config_dir=config_dir)
|
||||
if not os.path.exists(pidpath):
|
||||
print 'Not running ({})'.format(pidpath)
|
||||
return False
|
||||
|
||||
pid = blockstack_client.rpc.local_api_read_pidfile(pidpath)
|
||||
if pid is None:
|
||||
print "Failed to read pid file to kill api"
|
||||
return False
|
||||
|
||||
print 'Sending SIGKILL to {}'.format(pid)
|
||||
|
||||
# sigkill ensure process will die
|
||||
try:
|
||||
os.kill(pid, signal.SIGKILL)
|
||||
os.unlink(pidpath)
|
||||
except:
|
||||
print 'Issues killing API'
|
||||
|
||||
return True
|
||||
|
||||
def instantiate_wallet():
|
||||
"""
|
||||
Load the current wallet's addresses into bitcoin.
|
||||
|
||||
Reference in New Issue
Block a user