Skip to content

Commit

Permalink
[Cherry Pick] Enable canary report generation (awslabs#634)
Browse files Browse the repository at this point in the history
-enable canary report generation after each canary run.
  • Loading branch information
jsitu777 committed Apr 12, 2023
1 parent fa3483c commit e14a654
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 10 deletions.
14 changes: 10 additions & 4 deletions tests/canary/canary.buildspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ phases:
# Get cached test image
- aws ecr get-login-password --region $CLUSTER_REGION | docker login --username AWS --password-stdin $ECR_CACHE_URI || true
- docker pull ${ECR_CACHE_URI}:latest --quiet || true

# Build test image
- >
docker build -f ./tests/canary/Dockerfile.canary . -t ${ECR_CACHE_URI}:latest --quiet
Expand All @@ -15,8 +14,15 @@ phases:
commands:
# Run tests
- docker run --name kf-distro-canary $(env | cut -f1 -d= | sed 's/^/-e /') --mount type=bind,source="$(pwd)/",target="/kubeflow-manifests/" ${ECR_CACHE_URI}:latest

# Push test image to cache ECR repo
post_build:
commands:
- docker cp kf-distro-canary:/kubeflow-manifests/tests/canary/integration_tests.xml /tmp/results.xml || true
# Push test image to cache ECR repo
- docker push ${ECR_CACHE_URI}:latest || true


reports:
IntegrationTestReport:
files:
- "results.xml"
base-directory: "/tmp"

9 changes: 8 additions & 1 deletion tests/canary/scripts/push_stats_to_cloudwatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def readXML_and_publish_metrics_to_cw():
"Value": int(successes),
"Unit": "Count",
},
<<<<<<< HEAD
{
"MetricName": "success_rate",
"Timestamp": timestamp,
Expand All @@ -69,6 +70,8 @@ def readXML_and_publish_metrics_to_cw():
"Value": int(success_rate),
"Unit": "Percent",
},
=======
>>>>>>> 632ec70b ([Cherry Pick] Enable canary report generation (#634))
]

# Use the put_metric_data method to push the metric data to CloudWatch
Expand Down Expand Up @@ -98,4 +101,8 @@ def main():


if __name__ == "__main__":
main()
<<<<<<< HEAD
main()
=======
main()
>>>>>>> 632ec70b ([Cherry Pick] Enable canary report generation (#634))
10 changes: 5 additions & 5 deletions tests/canary/scripts/run_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
# Script configuration
set -euo pipefail

function onError {
echo "Run test FAILED. Exiting."
function push_to_cloudwatch {
echo "Pushing Codebuild stats to Cloudwatch."
python ../canary/scripts/push_stats_to_cloudwatch.py
}
trap onError ERR
trap push_to_cloudwatch EXIT

export CANARY_TEST_DIR=${REPO_PATH}/tests/canary
export E2E_TEST_DIR=${REPO_PATH}/tests/e2e
Expand All @@ -31,6 +32,5 @@ mkdir -p $E2E_TEST_DIR/.metadata/
cp metadata-canary $E2E_TEST_DIR/.metadata/

cd $E2E_TEST_DIR
pytest tests/test_sanity_portforward.py -s -q --metadata .metadata/metadata-canary --region $CLUSTER_REGION --installation_option $INSTALLATION_OPTION

pytest tests/test_sanity_portforward.py -s -q --metadata .metadata/metadata-canary --region $CLUSTER_REGION --installation_option $INSTALLATION_OPTION --junitxml ../canary/integration_tests.xml

0 comments on commit e14a654

Please sign in to comment.