Fix overlong junit filename prefixes (2nd attempt)

This commit is contained in:
Ivan Shvedunov 2016-08-22 17:00:24 +03:00
parent a6d37f7ead
commit 0ca373d0a4

View File

@ -155,12 +155,13 @@ junitFilenamePrefix() {
return return
fi fi
mkdir -p "${KUBE_JUNIT_REPORT_DIR}" mkdir -p "${KUBE_JUNIT_REPORT_DIR}"
local KUBE_TEST_API_NO_SLASH="${KUBE_TEST_API//\//-}" # This filename isn't parsed by anything, and we must avoid
# This filename isn't parsed by anything, # exceeding 255 character filename limit. KUBE_TEST_API
# and we must avoid exceeding 255 character filename limit. # barely fits there and in coverage mode test names are
KUBE_TEST_API_NO_SLASH="${KUBE_TEST_API_NO_SLASH//k8s.io-/}" # appended to generated file names, easily exceeding
KUBE_TEST_API_NO_SLASH="$(echo "$KUBE_TEST_API_NO_SLASH"|sed 's/\([0-9]\)alpha\([0-9]\)/\1a\2/g;s/\([0-9]\)beta\([0-9]\)/\1b\2/g')" # 255 chars in length. So let's just sha1sum it.
echo "${KUBE_JUNIT_REPORT_DIR}/junit_${KUBE_TEST_API_NO_SLASH}_$(kube::util::sortable_date)" local KUBE_TEST_API_HASH="$(echo -n "${KUBE_TEST_API//\//-}"|sha1sum|awk '{print $1}')"
echo "${KUBE_JUNIT_REPORT_DIR}/junit_${KUBE_TEST_API_HASH}_$(kube::util::sortable_date)"
} }
produceJUnitXMLReport() { produceJUnitXMLReport() {