Merge branch 'hotfix-blockstackd-port' into develop-option-payment-key

This commit is contained in:
Aaron Blankstein
2017-09-07 15:48:37 -04:00
7 changed files with 104 additions and 58 deletions

View File

@@ -711,7 +711,7 @@ def read_config_file(config_path=CONFIG_PATH, set_migrate=False):
if BLOCKSTACK_CLI_SERVER_PORT is not None:
try:
BLOCKSTACK_CLI_SERVER_PORT = int(BLOCKSTACK_CLI_SERVER_PORT)
BLOCKSTACK_CLI_SERVER_PORT = BLOCKSTACK_CLI_SERVER_PORT
except:
raise Exception("Invalid server port")
@@ -844,9 +844,15 @@ def read_config_file(config_path=CONFIG_PATH, set_migrate=False):
# add HTTPS support in 0.14.4.3
renamed_fields_014_4_3 = {}
dropped_fields_014_4_3 = {}
if ret['blockstack-client']['server'] == 'node.blockstack.org':
blockstackd_port_default = 6263
else:
blockstackd_port_default = 6264
changed_fields_014_4_3 = {
'blockstack-client': {
'port' : (str(6264), str(BLOCKSTACKD_PORT))
'port' : (str(6264), str(blockstackd_port_default))
}
}
@@ -924,7 +930,8 @@ def read_config_file(config_path=CONFIG_PATH, set_migrate=False):
changed_field_value = changed_field_set[sec][changed_field_name]
if isinstance(changed_field_value, tuple):
prior_default, new_default = changed_field_value
if ret[sec][changed_field_name] == prior_default:
old_value = ret[sec][changed_field_name]
if old_value == prior_default and old_value != new_default:
log.debug("Change {}.{} to {}".format(sec, changed_field_name, new_default))
ret[sec][changed_field_name] = new_default
migrated = True
@@ -951,6 +958,9 @@ def read_config_file(config_path=CONFIG_PATH, set_migrate=False):
log.debug("Override {}.{} from {} to {}".format(sec, field_name, ret[sec][field_name], new_value))
ret[sec][field_name] = new_value
# force client:port to int
if 'blockstack-client' in ret:
ret['blockstack-client']['port'] = int(ret['blockstack-client']['port'])
# helpful at runtime
ret['path'] = config_path

View File

@@ -29,7 +29,7 @@ import hashlib
import threading
import traceback
from .constants import DEFAULT_BLOCKSTACKD_PORT
from .config import get_config
from .logger import get_logger
log = get_logger('blockstack-client')
@@ -168,7 +168,7 @@ def daemonize( logpath, child_wait=None ):
return 0
def url_to_host_port(url, port=DEFAULT_BLOCKSTACKD_PORT):
def url_to_host_port(url, port=None):
"""
Given a URL, turn it into (host, port).
Return (None, None) on invalid URL
@@ -176,6 +176,10 @@ def url_to_host_port(url, port=DEFAULT_BLOCKSTACKD_PORT):
if not url.startswith('http://') or not url.startswith('https://'):
url = 'http://' + url
if not port:
conf = get_config()
port = conf['port']
urlinfo = urllib2.urlparse.urlparse(url)
hostport = urlinfo.netloc

View File

@@ -23,5 +23,5 @@
# this is the only place where version should be updated
__version_major__ = '0'
__version_minor__ = '14'
__version_patch__ = '4'
__version__ = '{}.{}.{}.2'.format(__version_major__, __version_minor__, __version_patch__)
__version_patch__ = '5'
__version__ = '{}.{}.{}.1'.format(__version_major__, __version_minor__, __version_patch__)

View File

@@ -1114,6 +1114,29 @@ def parse_args( argv ):
args, _ = parser.parse_known_args()
return args
def influx_write( influx_client, test_start, test_name, status ):
test_time = datetime.utcnow() - test_start
git_commit = os.environ["GIT_COMMIT"]
git_branch = os.environ["GIT_BRANCH"]
num_tests = os.environ["NUM_TESTS"]
point = [
{
"measurement": "integration_tests",
"tags": {
"git_branch": git_branch,
"git_commit": git_commit,
"status": status,
"test_scenario": test_name
},
"time": datetime.utcnow().isoformat(),
"fields": {
"runtime": test_time.seconds,
"num_tests": num_tests
}
}
]
influx_client.write_points(point)
if __name__ == "__main__":
@@ -1195,7 +1218,12 @@ if __name__ == "__main__":
# load up the scenario (so it can set its own extra envars)
scenario = load_scenario( scenario_module )
if scenario is None:
print "Failed to load '%s'" % scenario_module
if args.influx:
influx_write(influx_client, test_start, scenario_module.split(".")[2], "failure-load")
sys.exit(1)
# *now* we can import blockstack
@@ -1252,6 +1280,10 @@ if __name__ == "__main__":
{"ZONEFILES": os.path.join(working_dir, "zonefiles")} )
if rc != 0:
log.error("failed to write config file: exit %s" % rc)
if args.influx:
influx_write(influx_client, test_start, scenario_module.split(".")[2], "failure-config")
sys.exit(1)
# generate config file for the client
@@ -1269,6 +1301,9 @@ if __name__ == "__main__":
if rc != 0:
if args.influx:
influx_write(influx_client, test_start, scenario_module.split(".")[2], "failure-config")
log.error("failed to write config file: exit %s" % rc)
sys.exit(1)
@@ -1284,52 +1319,12 @@ if __name__ == "__main__":
print "SUCCESS %s" % scenario.__name__
# shutil.rmtree( working_dir )
if args.influx:
test_time = datetime.utcnow() - test_start
git_commit = os.environ["GIT_COMMIT"]
git_branch = os.environ["GIT_BRANCH"]
num_tests = os.environ["NUM_TESTS"]
point = [
{
"measurement": "integration_tests",
"tags": {
"git_branch": git_branch,
"git_commit": git_commit,
"success": True,
"test_scenario": scenario_module.split(".")[2]
},
"time": datetime.utcnow().isoformat(),
"fields": {
"runtime": test_time.microseconds,
"num_tests": num_tests
}
}
]
influx_client.write_points(point)
influx_write(influx_client, test_start, scenario_module.split(".")[2], "success")
sys.exit(0)
else:
if args.influx:
test_time = datetime.utcnow() - test_start
git_commit = os.environ["GIT_COMMIT"]
git_branch = os.environ["GIT_BRANCH"]
num_tests = os.environ["NUM_TESTS"]
point = [
{
"measurement": "integration_tests",
"tags": {
"git_branch": git_branch,
"git_commit": git_commit,
"success": True,
"test_scenario": scenario_module.split(".")[2]
},
"time": datetime.datetime.utcnow().isoformat(),
"fields": {
"runtime": test_time.microseconds,
"num_tests": num_tests
}
}
]
influx_client.write_points(point)
influx_write(influx_client, test_start, scenario_module.split(".")[2], "failure")
print >> sys.stderr, "FAILURE %s" % scenario.__name__
print >> sys.stderr, "Test output in %s" % working_dir

View File

@@ -1,6 +1,7 @@
# extras for test-launcher
__init__
attic
testlib
# list of tests to ignore
virtualchain_abort
name_preorder_register_update_file_benchmark

View File

@@ -119,7 +119,7 @@ spec:
- name: INFLUX_SSL
value: "$influxSSL"
- name: NUM_TESTS
value: $2
value: "$2"
resources:
limits:
cpu: 1000m
@@ -134,7 +134,10 @@ EOF
run-all-kube () {
local tmpDir=$testDir/tmp/$gitCommit
local scenarios=$(tests)
local numTests=${#scenarios[@]}
local numTests=0
for sc in $scenarios; do
((numTests++))
done
# Create kubernetes namespace
kubectl create ns $gitCommit
@@ -142,10 +145,11 @@ run-all-kube () {
# Make tmp directory
mkdir -p $tmpDir
echo "Running $numTests tests..."
# Make the manifests to launch the pods
for sc in $scenarios; do
make-manifest $sc $numTests
kubectl apply -f $tmpDir/$sc
kubectl apply -f $tmpDir/$sc.yaml
done
# Remove the temporary files
@@ -232,11 +236,10 @@ run-one-local () {
$testImage:$testTag $command >> /dev/null 2>&1
}
# get-runtime-docker $containerID -> gets duration of test in seconds
get-runtime-docker () {
local started=$(docker inspect $1 -f {{.State.StartedAt}})
local finished=$(docker inspect $1 -f {{.State.FinishedAt}})
local started=$(docker inspect -f {{.State.StartedAt}} $1)
local finished=$(docker inspect -f {{.State.FinishedAt}} $1)
local sunix=0
local funix=0
if [[ $(uname) == 'Linux' ]]; then
@@ -253,8 +256,8 @@ get-runtime-docker () {
results-local () {
local exited=$(docker ps -a -q -f status=exited -f name="$gitCommit")
for test in $exited; do
local success=$(docker logs $test --tail 100 2>&1 | grep -c "SUCCESS")
local failure=$(docker logs $test --tail 100 2>&1 | grep -c "FAILURE")
local success=$(docker logs $test --tail 120 2>&1 | grep -c "SUCCESS")
local failure=$(docker logs $test --tail 120 2>&1 | grep -c "FAILURE")
local name=$(docker inspect -f '{{.Name}}' $test)
local runtime=$(get-runtime-docker $test)
if [ $success -eq 1 ]; then
@@ -306,9 +309,13 @@ write-local () {
}
progress-local () {
local scenarios=$(tests)
local totaltests=0
for sc in $scenarios; do
((totaltests++))
done
local inprogress=$(expr $(docker ps -f status=running -f name="$gitCommit" | wc -l) - 1)
local completed=$(expr $(docker ps -a -f status=exited -f name="$gitCommit" | wc -l) - 1)
local totaltests=$(expr $(ls -1 $(pwd)/blockstack_integration_tests/scenarios/ | sed -e 's/\.py$//' | wc -l) - 2)
local remaining=$(expr $totaltests - $(expr $inprogress + $completed))
echo "TotalTests: $totaltests, Completed: $(percent $completed $totaltests)%, InProgress: $(percent $inprogress $totaltests)%, Remaining: $(percent $remaining $totaltests)%"
}

View File

@@ -0,0 +1,29 @@
What's New in 0.14.5
====================
Release 0.14.5 brings some improvements over 0.14.4. It does not
break consensus; 0.14-0.14.4 nodes are compatible with 0.14.5 nodes.
Release Highlights
------------------
* **Faster Search Indexing for New Names.** This release adds support scripts
to the `API` directory for supporting faster search indexing for new names. This
also includes support for indexing subdomains.
* **Added Docker Scripts.** This release includes support for running dockerized
versions of blockstack core and it's integration tests.
* **Include support for Transfers/Updates from Browser** This includes support
for supplying a key to perform updates and transfers on behalf of a RPC client.
* **Include support for HTTPS communication with Blockstack nodes** Clients now
by default attempt to communicate with node.blockstack.org servers over HTTPS.
Hotfix 0.14.5.1
---------------
* A pair of bugs in the blockstackd port lookup code resulted in a `blockstack api`
service *always* using 6263, even if the client.ini specifies otherwise. This led
to issues for non-default blockstackd setups.