Skip to content

Commit

Permalink
Add step to report rosacli testing result to report portal
Browse files Browse the repository at this point in the history
update

update

update

update

update

update

update

update

update

update
  • Loading branch information
yasun1 committed May 15, 2024
1 parent 71ff75e commit 47d15a4
Show file tree
Hide file tree
Showing 9 changed files with 89 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export TEST_PROFILE=${TEST_PROFILE}
# export CLUSTER_ID=$(cat "${SHARED_DIR}/cluster-id")

log(){
echo -e "\033[1m$(date "+%d-%m-%YT%H:%M:%S") " "${*}\033[0m"
echo -e "\033[1m$(date "+%d-%m-%YT%H:%M:%S") " "${*}"
}

# Configure aws
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export AVAILABLE_UPGRADE=${AVAILABLE_UPGRADE:-"no"}
CLUSTER_SECTOR=${CLUSTER_SECTOR:-}

log(){
echo -e "\033[1m$(date "+%d-%m-%YT%H:%M:%S") " "${*}\033[0m"
echo -e "\033[1m$(date "+%d-%m-%YT%H:%M:%S") " "${*}"
}

# Configure aws
Expand Down
1 change: 1 addition & 0 deletions ci-operator/step-registry/rosa/test/e2e/report/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

set -o nounset
set -o errexit
set -o pipefail

trap 'CHILDREN=$(jobs -p); if test -n "${CHILDREN}"; then kill ${CHILDREN} && wait; fi' TERM


log(){
echo -e "\033[1m$(date "+%d-%m-%YT%H:%M:%S") " "${*}"
}

tar -xvf ${SHARED_DIR}/junit.tar.gz -C ${ARTIFACT_DIR}

log "INFO: Generate report portal report ..."
rosatest --ginkgo.v --ginkgo.no-color --ginkgo.timeout "10m" --ginkgo.label-filter "e2e-report"
log "\nTest results:"
cat "$ARTIFACT_DIR/e2e-test-results.json"
# Remove the old junit.xml file
rm -rf ${ARTIFACT_DIR}/*.xml

failures=$(cat $ARTIFACT_DIR/e2e-test-results.json | jq -r '.failures')
if [[ $failures -gt 0 ]]; then
log "Error: Execute testing failed. Detail logs are under $ARTIFACT_DIR/junit"
exit 1
fi
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"path": "rosa/test/e2e/report/rosa-test-e2e-report-ref.yaml",
"owners": {
"approvers": [
"yasun1",
"xueli181114",
"yuwang-RH",
"yufchang",
"jtaleric",
"svetsa-rh",
"radtriste"
],
"reviewers": [
"yasun1",
"xueli181114",
"yuwang-RH",
"tzhou5",
"yingzhanredhat",
"yufchang",
"jtaleric",
"svetsa-rh",
"radtriste"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
ref:
as: rosa-test-e2e-report
from: rosa-aws-cli
grace_period: 10m
commands: rosa-test-e2e-report-commands.sh
resources:
requests:
cpu: 100m
memory: 300Mi
documentation: |-
Report the rosa CLI e2e results.
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ chain:
as: rosa-test-e2e
steps:
- ref: rosa-test-e2e
- ref: rosa-test-e2e-report
documentation: |-
This chain is for rosacli e2e testing.
32 changes: 20 additions & 12 deletions ci-operator/step-registry/rosa/test/e2e/rosa-test-e2e-commands.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ echo "Working on the cluster: $CLUSTER_ID"
export CLUSTER_ID # maybe we should get cluster_id by TEST_PROFILE

log(){
echo -e "\033[1m$(date "+%d-%m-%YT%H:%M:%S") " "${*}\033[0m"
echo -e "\033[1m$(date "+%d-%m-%YT%H:%M:%S") " "${*}"
}

# Configure aws
Expand Down Expand Up @@ -45,23 +45,31 @@ fi

# Variables
if [[ -z "$TEST_PROFILE" ]]; then
log "ERROR: " "TEST_PROFILE is mandatory."
log "ERROR: TEST_PROFILE is mandatory."
exit 1
fi

LABEL_FILTER_SWITCH=""
if [[ ! -z "$TEST_LABEL_FILTERS" ]]; then
LABEL_FILTER_SWITCH="--ginkgo.label-filter ${TEST_LABEL_FILTERS}"
LABEL_FILTER_SWITCH="--ginkgo.label-filter '${TEST_LABEL_FILTERS}'"
fi

log "INFO: Start e2e testing ..."
junit_xml="${TEST_PROFILE}-$(date +%m%d%s).xml"
rosatest --ginkgo.v --ginkgo.no-color \
junit_xml="${ARTIFACT_DIR}/rosa-e2e-${TEST_PROFILE}.xml"
cmd="rosatest --ginkgo.v --ginkgo.no-color \
--ginkgo.timeout ${TEST_TIMEOUT} \
--ginkgo.junit-report "${ARTIFACT_DIR}/$junit_xml" \
${LABEL_FILTER_SWITCH}
--ginkgo.junit-report $junit_xml \
${LABEL_FILTER_SWITCH}"
log "INFO: Start e2e testing ...\n$cmd"
eval "${cmd}" || true

# echo "$junit_xml" > "${SHARED_DIR}/junit-report-list"

# log "INFO: Generate report portal report ..."
# rosatest --ginkgo.v --ginkgo.no-color --ginkgo.timeout "10m" --ginkgo.label-filter "e2e-report"
# Envelope Junit files
junitTempDir=$(mktemp -d)
mv $junit_xml $junitTempDir
if [[ -f "${SHARED_DIR}/junit.tar.gz" ]]; then
tar -xvf "${SHARED_DIR}/junit.tar.gz" -C $junitTempDir
fi
cd $junitTempDir
rm -rf ${SHARED_DIR}/junit.tar.gz
tar -zcvf ${SHARED_DIR}/junit.tar.gz *.xml
cp ${SHARED_DIR}/junit.tar.gz ${ARTIFACT_DIR}
log "Testing is finished and uploaded."
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ ref:
commands: rosa-test-e2e-commands.sh
resources:
requests:
cpu: 100m
memory: 300Mi
cpu: 200m
memory: 600Mi
timeout: 6h0m0s
env:
- name: OCM_LOGIN_ENV
Expand Down

0 comments on commit 47d15a4

Please sign in to comment.