diff options
author | saw-jan <saw.jan.grg3e@gmail.com> | 2022-03-30 11:39:11 +0300 |
---|---|---|
committer | Sawjan Gurung <saw.jan.grg3e@gmail.com> | 2022-03-31 09:12:51 +0300 |
commit | d5b0cdbaa044f2a20b4776e9e42eb344523b3d94 (patch) | |
tree | 34c9dea1e84cb58458ae820314d877f4b19e59bc /test | |
parent | b139deb1f9bcc12c96f4cd96113531cf36bf9482 (diff) |
refactor, fix shellcheck warnings
Diffstat (limited to 'test')
-rw-r--r-- | test/gui/drone/comment.sh | 4 | ||||
-rw-r--r-- | test/gui/drone/notification_template.sh | 6 | ||||
-rw-r--r-- | test/gui/shared/scripts/bdd_hooks.py | 6 | ||||
-rw-r--r-- | test/gui/shared/scripts/helpers/StacktraceHelper.py | 7 |
4 files changed, 11 insertions, 12 deletions
diff --git a/test/gui/drone/comment.sh b/test/gui/drone/comment.sh index 2b156aed6..550098075 100644 --- a/test/gui/drone/comment.sh +++ b/test/gui/drone/comment.sh @@ -24,9 +24,9 @@ else fi # if there is stacktrace file then add to the comment - if [[ -f $1/stacktrace ]]; then + if [[ -f $1/stacktrace.log ]]; then echo "creating comment for stacktrace" - echo "Stacktrace: (${CACHE_ENDPOINT}/${CACHE_BUCKET}/$2/$3/guiReportUpload/stacktrace)" >> $1/comments.file + echo "Stacktrace: (${CACHE_ENDPOINT}/${CACHE_BUCKET}/$2/$3/guiReportUpload/stacktrace.log)" >> $1/comments.file fi if ! [[ $(find $1/screenshots -maxdepth 0 -empty) ]]; then diff --git a/test/gui/drone/notification_template.sh b/test/gui/drone/notification_template.sh index c8e3fda33..ed5cd73bb 100644 --- a/test/gui/drone/notification_template.sh +++ b/test/gui/drone/notification_template.sh @@ -8,9 +8,9 @@ COMMIT_SHA_SHORT=${DRONE_COMMIT:0:8} GUI_LOG="${CACHE_ENDPOINT}/${CACHE_BUCKET}/${DRONE_REPO}/${DRONE_BUILD_NUMBER}/guiReportUpload/index.html" SERVER_LOG="${CACHE_ENDPOINT}/${CACHE_BUCKET}/${DRONE_REPO}/${DRONE_BUILD_NUMBER}/guiReportUpload/serverlog.log" -STACKTRACE="${CACHE_ENDPOINT}/${CACHE_BUCKET}/${DRONE_REPO}/${DRONE_BUILD_NUMBER}/guiReportUpload/stacktrace" +STACKTRACE="${CACHE_ENDPOINT}/${CACHE_BUCKET}/${DRONE_REPO}/${DRONE_BUILD_NUMBER}/guiReportUpload/stacktrace.log" -CURL="curl --write-out "%{http_code}" --silent --output /dev/null" +CURL="curl --write-out %{http_code} --silent --output /dev/null" GUI_STATUS_CODE=$($CURL "$GUI_LOG") SERVER_STATUS_CODE=$($CURL "$SERVER_LOG") @@ -32,4 +32,4 @@ if [ "${DRONE_BUILD_STATUS}" != "success" ]; then fi fi -echo -e "**$BUILD_STATUS** [${DRONE_REPO}#${COMMIT_SHA_SHORT}](${DRONE_BUILD_LINK}) (${DRONE_BRANCH}) by **${DRONE_COMMIT_AUTHOR}** $TEST_LOGS" > $1/template.md
\ No newline at end of file +echo -e "**$BUILD_STATUS** [${DRONE_REPO}#${COMMIT_SHA_SHORT}](${DRONE_BUILD_LINK}) (${DRONE_BRANCH}) by **${DRONE_COMMIT_AUTHOR}** $TEST_LOGS" > "$1"/template.md
\ No newline at end of file diff --git a/test/gui/shared/scripts/bdd_hooks.py b/test/gui/shared/scripts/bdd_hooks.py index 564ae0863..bcdf2c1a4 100644 --- a/test/gui/shared/scripts/bdd_hooks.py +++ b/test/gui/shared/scripts/bdd_hooks.py @@ -19,7 +19,7 @@ import shutil import urllib.request import os import builtins -from helpers.StacktraceHelper import getCoredump, generateStacktrace +from helpers.StacktraceHelper import getCoredumps, generateStacktrace @OnScenarioStart @@ -96,8 +96,8 @@ def hook(context): def hook(context): # search coredumps after every test scenario # CI pipeline might fail although all tests are passing - coredumps = getCoredump() - if len(coredumps) > 0: + coredumps = getCoredumps() + if coredumps: try: generateStacktrace(context, coredumps) print("Stacktrace generated.") diff --git a/test/gui/shared/scripts/helpers/StacktraceHelper.py b/test/gui/shared/scripts/helpers/StacktraceHelper.py index 01133ff2d..14dc2e5c6 100644 --- a/test/gui/shared/scripts/helpers/StacktraceHelper.py +++ b/test/gui/shared/scripts/helpers/StacktraceHelper.py @@ -1,12 +1,11 @@ import os -import builtins import subprocess import glob import re from datetime import datetime -def getCoredump(): +def getCoredumps(): # read coredump location with open("/proc/sys/kernel/core_pattern", "r") as f: coredumpPath = f.read().strip("\n") @@ -27,14 +26,14 @@ def generateStacktrace(context, coredumps): message.append("") message = "\n".join(message) - stacktrace_file = os.environ.get("STACKTRACE_FILE", "../stacktrace") + stacktrace_file = os.environ.get("STACKTRACE_FILE", "../stacktrace.log") # save stacktrace to a file open(stacktrace_file, "a").write(message) def parseStacktrace(coredumpFile): message = [] - if builtins.bool(coredumpFile): + if coredumpFile: coredumpFilename = os.path.basename(coredumpFile) # example coredump file: core-1648445754-1001-11-!drone!src!build-GUI-tests!bin!owncloud patterns = coredumpFilename.split('-') |