Skip to content

Commit

Permalink
capture-logs
Browse files Browse the repository at this point in the history
  • Loading branch information
sanchezl committed Feb 4, 2020
1 parent bdbabbc commit 1abfac2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
12 changes: 8 additions & 4 deletions test/e2e/test-cmd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ if [[ $rc -ne 0 ]]; then
TLS_ARGS=""
fi

function capture-logs() {
echo "initializer logs:"
kubectl logs --namespace=kube-system job/initializer || true
echo "migrator logs:"
kubectl logs --namespace=kube-system deployment/migrator || true
}

function wait-for-migration()
{
Expand Down Expand Up @@ -63,6 +69,7 @@ function wait-for-migration()
# Note that number=1 when pendings="".
number=$(echo "${pendings}" | wc -l)
if [ -z "${pendings}" ]; then
capture-logs
return 0
else
echo "${number} migrations haven't succeeded yet"
Expand All @@ -75,10 +82,7 @@ function wait-for-migration()
done

echo "Timed out waiting for migration to complete."
echo "initializer logs:"
kubectl logs --namespace=kube-system -l job-name=initializer || true
echo "migrator logs:"
kubectl logs --namespace=kube-system -l app=migrator || true
capture-logs
return 1
}

Expand Down
11 changes: 11 additions & 0 deletions test/e2e/test-fully-automated.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,16 @@ cleanup() {
return
fi
pushd "${MIGRATOR_ROOT}"
echo "===== initializer logs"
kubectl logs --namespace=kube-system job/initializer || true
echo "===== migrator logs"
kubectl logs --namespace=kube-system deployment/migrator || true
echo "===== trigger logs"
kubectl logs --namespace=kube-system deployment/trigger || true
echo "===== storageversionmigrations"
kubectl get storageversionmigrations.migration.k8s.io -o yaml
echo "===== storagestates"
kubectl get storagestates.migration.k8s.io -o yaml
echo "Deleting images"
make delete-all-images
echo "Deleting images successfully"
Expand All @@ -59,3 +69,4 @@ pushd "${MIGRATOR_ROOT}"
make e2e-test
"${ginkgo}" -v "$@" "${MIGRATOR_ROOT}/test/e2e/e2e.test"
popd

0 comments on commit 1abfac2

Please sign in to comment.