added ginkgo junit reports (#9350)

This commit is contained in:
Long Wu Yuan 2022-12-03 07:13:53 +05:30 committed by GitHub
parent 3437cab8ca
commit c234d1f10b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 51 additions and 0 deletions

View file

@ -88,3 +88,38 @@ kubectl run --rm \
--overrides='{ "apiVersion": "v1", "spec":{"serviceAccountName": "ingress-nginx-e2e"}}' \
e2e --image=nginx-ingress-controller:e2e
# Get the junit-reports stored in the configMaps created during e2etests
echo "Getting the report files out now.."
reportsDir="test/junitreports"
reportFileName="report-e2e-test-suite"
[ ! -e ${reportsDir} ] && mkdir $reportsDir
cd $reportsDir
# TODO: Seeking Rikatz help here to extract in a loop. Tried things like below without success
#for cmName in `k get cm -l junitreport=true -o json | jq '.items[].binaryData | keys[]' | tr '\"' ' '`
#do
#
# kubectl get cm -l junitreport=true -o json | jq -r '[.items[].binaryData | to_entries[] | {"key": .key, "value": .value }] | from_entries'
#
# Below lines successfully extract the report but they are one line per report.
# We only have 3 ginkgo reports so its ok for now
# But still, ideally this should be a loop as talked about in comments a few lines above
kubectl get cm $reportFileName.xml.gz -o "jsonpath={.binaryData['report-e2e-test-suite\.xml\.gz']}" > $reportFileName.xml.gz.base64
kubectl get cm $reportFileName-serial.xml.gz -o "jsonpath={.binaryData['report-e2e-test-suite-serial\.xml\.gz']}" > $reportFileName-serial.xml.gz.base64
cat $reportFileName.xml.gz.base64 | base64 -d > $reportFileName.xml.gz
cat $reportFileName-serial.xml.gz.base64 | base64 -d > $reportFileName-serial.xml.gz
gzip -d $reportFileName.xml.gz
gzip -d $reportFileName-serial.xml.gz
rm *.base64
cd ../..
# TODO Temporary: if condition to check if the memleak cm exists and only then try the extract for the memleak report
#
#kubectl get cm $reportFileName-serial -o "jsonpath={.data['report-e2e-test-suite-memleak\.xml\.gz']}" > $reportFileName-memleak.base64
#cat $reportFileName-memleak.base64 | base64 -d > $reportFileName-memleak.xml.gz
#gzip -d $reportFileName-memleak.xml.gz
echo "done getting the reports files out.."

View file

@ -34,23 +34,39 @@ ginkgo_args=(
"-timeout=75m"
)
# Variable for the prefix of report filenames
reportFileNamePrefix="report-e2e-test-suite"
echo -e "${BGREEN}Running e2e test suite (FOCUS=${FOCUS})...${NC}"
ginkgo "${ginkgo_args[@]}" \
-focus="${FOCUS}" \
-skip="\[Serial\]|\[MemoryLeak\]" \
-nodes="${E2E_NODES}" \
--junit-report=$reportFileNamePrefix.xml \
/e2e.test
# Create configMap out of a compressed report file for extraction later
echo -e "${BGREEN}Running e2e test suite with tests that require serial execution...${NC}"
ginkgo "${ginkgo_args[@]}" \
-focus="\[Serial\]" \
-skip="\[MemoryLeak\]" \
--junit-report=$reportFileNamePrefix-serial.xml \
/e2e.test
# Create configMap out of a compressed report file for extraction later
if [[ ${E2E_CHECK_LEAKS} != "" ]]; then
echo -e "${BGREEN}Running e2e test suite with tests that check for memory leaks...${NC}"
ginkgo "${ginkgo_args[@]}" \
-focus="\[MemoryLeak\]" \
-skip="\[Serial\]" \
--junit-report=$reportFileNamePrefix-memleak.xml \
/e2e.test
# Create configMap out of a compressed report file for extraction later
fi
for rFile in `ls $reportFileNamePrefix*`
do
gzip -k $rFile
kubectl create cm $rFile.gz --from-file $rFile.gz
kubectl label cm $rFile.gz junitreport=true
done