Skip to content

Commit 6a8ceb3

Browse files
moneymanolisk9ert
andauthored
Chore: More precise grep in Cypress bash script (#1911)
* more precise grep in test-cypress.sh + log_cli set to True in pytest.ini * comment log_cli out * fix issue when there is no python process running at all Co-authored-by: k9ert <[email protected]>
1 parent 8b867d6 commit 6a8ceb3

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

pytest.ini

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ addopts = --bitcoind-version v22.0.0 --elementsd-version v0.21.0.2
55
markers =
66
slow: mark test as slow.
77
elm: mark test as elementsd dependent
8-
#log_cli = 1
8+
# If you need live logging to debug, uncomment the next line
9+
# log_cli = True
10+
# Then set the desired logging level on the command line, for example:
11+
# pytest --log-cli-level INFO
912

1013
filterwarnings =
1114
ignore::DeprecationWarning:bitbox02[.*]

utils/test-cypress.sh

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,24 @@ fi
2020

2121
function check_consistency {
2222
if ! npm version 2> /dev/null 1>&2 ; then
23-
echo "npm is not on the PATH. Please install node and bring on the PATH"
23+
echo "npm is not on the PATH. Please install node and bring it on the PATH."
2424
exit 1
2525
fi
26-
if ps | grep python | grep -v grep ; then # the second grep might be necessary because MacOs has a non POSIX ps
27-
echo "there is still a python-process running which is suspicious. Maybe wait a few more seconds"
28-
sleep 5
29-
ps | grep python && (echo "please investigate or kill " && exit 1)
26+
if ! ps | grep python | grep -q -v grep; then
27+
echo "There are no other Python processes running, good to go!"
28+
else
29+
GREP_OUTPUT=$(ps | grep python | grep -v grep)
30+
SPECTER_STR="cryptoadvance.specter server"
31+
while read -r line; do # https://unix.stackexchange.com/questions/9784/how-can-i-read-line-by-line-from-a-variable-in-bash
32+
if [[ "$line" == *"$SPECTER_STR"* ]]; then
33+
echo "There is another Specter process running, this is fine."
34+
else
35+
echo "There is a suspicious Python process running. Maybe wait a few more seconds."
36+
sleep 5
37+
echo "Please investigate the following process and perhaps kill: $line"
38+
exit 1
39+
fi
40+
done <<< "$GREP_OUTPUT"
3041
fi
3142
$(npm bin)/cypress verify
3243
}

0 commit comments

Comments
 (0)