Remove kube stuff from test-launcher

This commit is contained in:
Jack Zampolin
2017-09-26 14:37:05 -04:00
4 changed files with 125 additions and 7 deletions

View File

@@ -197,12 +197,13 @@ def format_profile(profile, fqa, zone_file, refresh=False):
NAME_PATTERN = re.compile(OP_NAME_PATTERN)
NS_PATTERN = re.compile(OP_NAMESPACE_PATTERN)
def is_valid_fqa(fqa):
if (NAME_PATTERN.match(fqa) is None):
return False
try:
username, ns = fqa.split(".")
except:
return False
return ((NAME_PATTERN.match(username) is not None) and
(NS_PATTERN.match(ns) is not None))
return (NS_PATTERN.match(ns) is not None)
def get_profile(fqa, refresh=False):
""" Given a fully-qualified username (username.namespace)

View File

@@ -97,10 +97,12 @@ def get_unspents(address, blockchain_client):
addresses)
if constants.BLOCKSTACK_TESTNET and len(unspents) == 0:
bitcoind.importaddress(str(address))
unspents = bitcoind.listunspent(min_confirmations, max_confirmation,
addresses)
try:
bitcoind.importaddress(str(address))
unspents = bitcoind.listunspent(min_confirmations, max_confirmation,
addresses)
except Exception as e:
return format_unspents([])
return format_unspents(unspents)

View File

@@ -24,4 +24,4 @@
__version_major__ = '0'
__version_minor__ = '16'
__version_patch__ = '0'
__version__ = '{}.{}.{}.0'.format(__version_major__, __version_minor__, __version_patch__)
__version__ = '{}.{}.{}.1'.format(__version_major__, __version_minor__, __version_patch__)

View File

@@ -0,0 +1,115 @@
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Blockstack
~~~~~
copyright: (c) 2014-2015 by Halfmoon Labs, Inc.
copyright: (c) 2016 by Blockstack.org
This file is part of Blockstack
Blockstack is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Blockstack is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Blockstack. If not, see <http://www.gnu.org/licenses/>.
"""
import os
import testlib
import pybitcoin
import urllib2
import json
import blockstack_client
import blockstack_profiles
import blockstack_zones
import sys
import time
import virtualchain
from keylib import ECPrivateKey, ECPublicKey
wallets = [
testlib.Wallet( "5JesPiN68qt44Hc2nT8qmyZ1JDwHebfoh9KQ52Lazb1m1LaKNj9", 100000000000 ),
testlib.Wallet( "5KHqsiU9qa77frZb6hQy9ocV7Sus9RWJcQGYYBJJBb2Efj1o77e", 100000000000 ),
testlib.Wallet( "5Kg5kJbQHvk1B64rJniEmgbD83FpZpbw2RjdAZEzTefs9ihN3Bz", 100000000000 ),
testlib.Wallet( "5JuVsoS9NauksSkqEjbUZxWwgGDQbMwPsEfoRBSpLpgDX1RtLX7", 100000000000 ),
testlib.Wallet( "5KEpiSRr1BrT8vRD7LKGCEmudokTh1iMHbiThMQpLdwBwhDJB1T", 100000000000 ),
testlib.Wallet( "5K5hDuynZ6EQrZ4efrchCwy6DLhdsEzuJtTDAf3hqdsCKbxfoeD", 100000000000 ),
testlib.Wallet( "5J39aXEeHh9LwfQ4Gy5Vieo7sbqiUMBXkPH7SaMHixJhSSBpAqz", 100000000000 ),
testlib.Wallet( "5K9LmMQskQ9jP1p7dyieLDAeB6vsAj4GK8dmGNJAXS1qHDqnWhP", 100000000000 ),
testlib.Wallet( "5KcNen67ERBuvz2f649t9F2o1ddTjC5pVUEqcMtbxNgHqgxG2gZ", 100000000000 ),
testlib.Wallet( "5KMbNjgZt29V6VNbcAmebaUT2CZMxqSridtM46jv4NkKTP8DHdV", 100000000000 ),
]
consensus = "17ac43c1d8549c3181b200f1bf97eb7d"
error = False
def scenario( wallets, **kw ):
global wallet_keys, wallet_keys_2, error, index_file_data, resource_data
empty_key = ECPrivateKey().to_hex()
wallet_keys = testlib.blockstack_client_initialize_wallet(
"0123456789abcdef", wallets[1].privkey, wallets[2].privkey, wallets[0].privkey)
test_proxy = testlib.TestAPIProxy()
blockstack_client.set_default_proxy( test_proxy )
testlib.blockstack_namespace_preorder( "test", wallets[1].addr, wallets[0].privkey )
testlib.next_block( **kw )
testlib.blockstack_namespace_reveal( "test", wallets[1].addr, 52595, 250, 4, [6,5,4,3,2,1,0,0,0,0,0,0,0,0,0,0], 10, 10, wallets[0].privkey )
testlib.next_block( **kw )
testlib.blockstack_namespace_ready( "test", wallets[1].privkey )
testlib.next_block( **kw )
# tell serialization-checker that value_hash can be ignored here
print "BLOCKSTACK_SERIALIZATION_CHECK_IGNORE value_hash"
sys.stdout.flush()
testlib.next_block( **kw )
config_path = os.environ.get("BLOCKSTACK_CLIENT_CONFIG", None)
config_dir = os.path.dirname(config_path)
conf = blockstack_client.get_config(config_path)
assert conf
api_pass = conf['api_password']
# let's do a withdraw of all
res = testlib.blockstack_REST_call('POST', '/v1/wallet/balance', None, api_pass=api_pass, data= {
'address' : virtualchain.get_privkey_address(empty_key),
})
if 'error' in res['response']:
res['test'] = 'Failed to perform withdraw'
print json.dumps(res)
error = True
return False
for i in xrange (0, 1):
testlib.next_block( **kw )
print 'Waiting for the withdraw to go through'
res = testlib.blockstack_REST_call('GET', '/v1/wallet/balance/0', None, api_pass=api_pass)
if 'error' in res['response']:
res['test'] = 'Failed to get wallet balance'
print json.dumps(res)
error = True
return False
res = testlib.blockstack_REST_call('GET', '/v1/wallet/balance/0', None, api_pass=api_pass)
if 'error' in res['response']:
res['test'] = 'Failed to get wallet balance'
print json.dumps(res)
error = True
return False
def check( state_engine ):
return True