Skip to content

Commit ab31c63

Browse files
authored
Revert "chore: improve smokeTests environment validation and logging"
1 parent 153d242 commit ab31c63

File tree

2 files changed

+24
-59
lines changed

2 files changed

+24
-59
lines changed

pnpm-lock.yaml

+1-30
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/smokeTests.sh

+23-29
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
#!/bin/bash
22

3-
# Strict mode, exit on error, undefined variables, and pipe failures
4-
set -euo pipefail
5-
63
# Print some information about the environment to aid in case of troubleshooting
74

85
echo "node version:"
@@ -30,63 +27,60 @@ if (( CURRENT_NODE_VERSION < REQUIRED_NODE_VERSION )); then
3027
fi
3128

3229
# Autodetect project directory relative to this script's path
33-
PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
30+
PROJECT_DIR="$0"
31+
while [ -h "$PROJECT_DIR" ]; do
32+
ls=$(ls -ld "$PROJECT_DIR")
33+
link=$(expr "$ls" : '.*-> \(.*\)$')
34+
if expr "$link" : '/.*' > /dev/null; then
35+
PROJECT_DIR="$link"
36+
else
37+
PROJECT_DIR="$(dirname "$PROJECT_DIR")/$link"
38+
fi
39+
done
40+
PROJECT_DIR="$(dirname "$PROJECT_DIR")/.."
41+
PROJECT_DIR="$(cd "$PROJECT_DIR"; pwd)"
3442

35-
cd "$PROJECT_DIR"
43+
cd $PROJECT_DIR
3644

3745
cp .env.example .env
3846

3947
pnpm install -r
4048

4149
pnpm build
4250

43-
# Create temp file and ensure cleanup
4451
OUTFILE="$(mktemp)"
45-
trap 'rm -f "$OUTFILE"' EXIT
46-
echo "Using temporary output file: $OUTFILE"
47-
48-
# Add timeout configuration
49-
TIMEOUT=30
50-
INTERVAL=0.5
51-
TIMER=0
52-
52+
echo $OUTFILE
5353
(
54-
# Wait for the ready message with timeout
54+
# Wait for the ready message
5555
while true; do
56-
if [[ $TIMER -ge $TIMEOUT ]]; then
57-
echo "Error: Timeout waiting for application to start after $TIMEOUT seconds"
58-
kill $$
59-
exit 1
60-
fi
61-
6256
if grep -q "Chat started" "$OUTFILE"; then
6357
echo "exit"; sleep 2
6458
break
6559
fi
66-
67-
sleep $INTERVAL
68-
TIMER=$(echo "$TIMER + $INTERVAL" | bc)
60+
sleep 0.5
6961
done
7062
) | pnpm start --character=characters/trump.character.json > "$OUTFILE" &
7163

7264
# Wait for process to finish
7365
wait $!
7466
RESULT=$?
75-
7667
echo "----- OUTPUT START -----"
7768
cat "$OUTFILE"
7869
echo "----- OUTPUT END -----"
7970

8071
# Check the exit code of the last command
8172
if [[ $RESULT -ne 0 ]]; then
82-
echo "Error: 'start' command exited with an error (code: $RESULT)"
73+
echo "Error: 'start' command exited with an error."
8374
exit 1
8475
fi
8576

86-
# Check if output contains expected termination message
77+
# Check if output.txt contains "Terminating and cleaning up resources..."
8778
if grep -q "Terminating and cleaning up resources..." "$OUTFILE"; then
8879
echo "Script completed successfully."
8980
else
90-
echo "Error: The output does not contain the expected termination message."
81+
echo "Error: The output does not contain the expected string."
9182
exit 1
92-
fi
83+
fi
84+
85+
# Clean up
86+
rm "$OUTFILE"

0 commit comments

Comments
 (0)