Skip to content

Commit

Permalink
Merge pull request #494 from umangachapagain/ocp-must-gather
Browse files Browse the repository at this point in the history
adds OCP must-gather to tests
  • Loading branch information
openshift-merge-robot committed May 28, 2020
2 parents 74352d6 + b52a80d commit 63796eb
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 17 deletions.
8 changes: 8 additions & 0 deletions functests/setup_teardown.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package functests

import (
"flag"
"os"
"os/exec"

"github.com/onsi/gomega"
deploymanager "github.com/openshift/ocs-operator/pkg/deploy-manager"
Expand Down Expand Up @@ -30,6 +32,12 @@ func AfterTestSuiteCleanup() {
t, err := deploymanager.NewDeployManager()
gomega.Expect(err).To(gomega.BeNil())

// collect debug log before deleting namespace & cluster
gopath := os.Getenv("GOPATH")
cmd := exec.Command("/bin/bash", gopath+"/src/github.com/openshift/ocs-operator/hack/dump-debug-info.sh")
_, err = cmd.CombinedOutput()
gomega.Expect(err).To(gomega.BeNil())

err = t.DeleteNamespaceAndWait(TestNamespace)
gomega.Expect(err).To(gomega.BeNil())

Expand Down
28 changes: 12 additions & 16 deletions hack/dump-debug-info.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,19 @@
source hack/common.sh

echo "dumping debug information"
echo "--- PODS ----"
${OCS_OC_PATH} get pods -n openshift-storage
echo "---- PVs ----"
${OCS_OC_PATH} get pv
echo "--- StorageClasses ----"
${OCS_OC_PATH} get storageclass --all-namespaces
echo "--- StorageCluster ---"
${OCS_OC_PATH} get storagecluster --all-namespaces -o yaml
echo "--- CephCluster ---"
${OCS_OC_PATH} get cephcluster --all-namespaces -o yaml
echo "--- Noobaa ---"
${OCS_OC_PATH} get noobaa --all-namespaces -o yaml

echo "Running ocs-must-gather"
MUST_GATHER_DIR="ocs-must-gather"
OCS_MUST_GATHER_DIR="ocs-must-gather"
if [ -n "$OPENSHIFT_BUILD_NAMESPACE" ]; then
MUST_GATHER_DIR="/tmp/artifacts/ocs-must-gather"
OCS_MUST_GATHER_DIR="/tmp/artifacts/ocs-must-gather"
fi
mkdir -p $MUST_GATHER_DIR
${OCS_OC_PATH} adm must-gather --image "$MUST_GATHER_FULL_IMAGE_NAME" --dest-dir "$MUST_GATHER_DIR"
mkdir -p $OCS_MUST_GATHER_DIR
${OCS_OC_PATH} adm must-gather --image "$MUST_GATHER_FULL_IMAGE_NAME" --dest-dir "$OCS_MUST_GATHER_DIR"

echo "Running ocp-must-gather"
OCP_MUST_GATHER_DIR="ocp-must-gather"
if [ -n "$OPENSHIFT_BUILD_NAMESPACE" ]; then
OCP_MUST_GATHER_DIR="/tmp/artifacts/ocp-must-gather"
fi
mkdir -p $OCP_MUST_GATHER_DIR
${OCS_OC_PATH} --insecure-skip-tls-verify adm must-gather --dest-dir "$OCP_MUST_GATHER_DIR"
1 change: 0 additions & 1 deletion hack/functest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ $OUTDIR_BIN/functests --ocs-registry-image="${CATALOG_FULL_IMAGE_NAME}" \
--ocs-cluster-uninstall="${OCS_CLUSTER_UNINSTALL}" "$@"

if [ $? -ne 0 ]; then
hack/dump-debug-info.sh
echo "ERROR: Functest failed."
exit 1
fi

0 comments on commit 63796eb

Please sign in to comment.