Promenade Test Fix

Required for Promenade validateDesign for Shipyard

Change-Id: I37eaceb1d57123d4d38737e1d3e6e0ae822f50f1
This commit is contained in:
One-Fine-Day 2018-04-06 14:25:36 -05:00 committed by Felipe Monteiro
parent 05e51de7aa
commit 01d0b17d8e
2 changed files with 11 additions and 10 deletions

View File

@ -53,9 +53,11 @@ class BaseResource(object):
raw_body = req.stream.read(req.content_length or 0)
if raw_body is not None:
has_input = True
self.info(req.context, 'Input message body: %s' % raw_body)
LOG.info('Input message body: %s \nContext: %s' %
(raw_body, req.context))
else:
self.info(req.context, 'No message body specified')
LOG.info(
'No message body specified. \nContext: %s' % req.context)
if has_input:
# read the json and validate if necessary
try:
@ -66,8 +68,8 @@ class BaseResource(object):
validate(json_body, json.loads(validate_json_schema))
return json_body
except json.JSONDecodeError as jex:
self.error(req.context,
"Invalid JSON in request: \n%s" % raw_body)
LOG.error('Invalid JSON in request: \n%s \nContext: %s' %
(raw_body, req.context))
raise exc.InvalidFormatError(
title='JSON could not be decoded',
description='%s: Invalid JSON in body: %s' % (req.path,

View File

@ -73,15 +73,14 @@ render_curl_url() {
echo "${BASE_URL}?${DESIGN_REF}&${HOST_PARAMS}${LABEL_PARAMS}"
}
render_validate_url() {
BASE_URL="${BASE_PROM_URL}/api/v1.0/validatedesign"
render_validate_body() {
if [[ ${USE_DECKHAND} == 1 ]]; then
HREF="href=deckhand%2Bhttp://deckhand-int.ucp.svc.cluster.local:9000/api/v1.0/revisions/${DECKHAND_REVISION}/rendered-documents"
JSON="{\"rel\":\"design\",\"href\":\"deckhand+http://deckhand-int.ucp.svc.cluster.local:9000/api/v1.0/revisions/${DECKHAND_REVISION}/rendered-documents\",\"type\":\"application/x-yaml\"}"
else
HREF="href=${NGINX_URL}/promenade.yaml"
JSON="{\"rel\":\"design\",\"href\":\"${NGINX_URL}/promenade.yaml\",\"type\":\"application/x-yaml\"}"
fi
echo "${BASE_URL}?${HREF}"
echo ${JSON}
}
mkdir -p "${SCRIPT_DIR}"
@ -115,7 +114,7 @@ for NAME in "${NODES[@]}"; do
done
log "Validating documents"
ssh_cmd "${VIA}" curl -v "${CURL_ARGS[@]}" -X POST "$(render_validate_url)"
ssh_cmd "${VIA}" curl -v "${CURL_ARGS[@]}" -X POST -H "Content-Type: application/json" -d $(render_validate_body) "${BASE_PROM_URL}/api/v1.0/validatedesign"
JOIN_CURL_URL="$(render_curl_url "${NAME}" "${LABELS[@]}")"
log "Fetching join script via: ${JOIN_CURL_URL}"