Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ Automated validation tool for testing DevWorkspace instances on OpenShift cluste
# Debug mode - verbose + runs only first test + no cleanup
./dw-auto-validate.sh -d

# Skip interactive scenario choice (valid values: sshd, jetbrains, vscode)
./dw-auto-validate.sh -s vscode

# Help
./dw-auto-validate.sh -h
```
Expand Down Expand Up @@ -56,6 +59,7 @@ Automated validation tool for testing DevWorkspace instances on OpenShift cluste
- `-v`: Verbose mode - enables `log()` output, shows detailed progress
- `-f`: Full mode - uses `images/images-full.txt` and `devfiles/devfiles-full.txt` instead of their default counterparts
- `-d`: Debug mode - enables verbose + debug output, runs only first test, skips cleanup
- `-s <scenario>`: Skip interactive scenario prompt by specifying the scenario directly (`sshd`, `jetbrains`, or `vscode`)
- `-h`: Help - displays usage information

**Debug mode specifics**: Sets `DEBUG=1`, `FULL=0`, `VERBOSE=1`, runs only the first test iteration (`[[ ${DEBUG} -eq 1 && ${total_count} == 1 ]] && continue`), skips cleanup to allow resource inspection.
Expand Down
38 changes: 24 additions & 14 deletions dw-auto-validate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
VERBOSE=0
FULL=0
DEBUG=0
SCENARIO=""

# colors for fun
RED='\033[1;91m'
Expand All @@ -16,9 +17,9 @@ NC='\033[0m' # No Color
# Parameters for fun or experts #
#################################

while getopts "vfdh" o; do
while getopts "vfdhs:" o; do
case "${o}" in
v)
v)
VERBOSE=1
echo "Using verbose mode."
;;
Expand All @@ -32,8 +33,16 @@ while getopts "vfdh" o; do
VERBOSE=1
echo -e "Using verbose mode AND do not clean resource. ${YELLOW}WARNING${NC} - This mode uses only the first item of the test matrix."
;;
s)
SCENARIO="${OPTARG}"
if [[ ! "${SCENARIO}" =~ ^(sshd|jetbrains|vscode)$ ]]; then
echo -e "${RED}Error:${NC} Invalid scenario '${SCENARIO}'. Valid options are: sshd, jetbrains, vscode." >&2
exit 1
fi
echo "Using scenario '${SCENARIO}'."
;;
h)
echo "Help: This script accepts -v for verbose mode, -d for debug mode and -f for full images test and -h for help."
echo "Help: This script accepts -v for verbose mode, -d for debug mode, -f for full images test, -s <scenario> to skip scenario choice (sshd|jetbrains|vscode) and -h for help."
;;
\?)
echo "Invalid option: -$OPTARG"
Expand Down Expand Up @@ -122,17 +131,18 @@ else
fi

# Choose scenario
echo -e "${BLUE}Choose the dedicated scenario to run the validation test suite.${NC}\n1-sshd\n2-jetbrains\n3-vscode"
SCENARIO=""
while true; do
read -p "(1/2/3)? : " scenario
case $scenario in
1 ) SCENARIO=sshd; break;;
2 ) SCENARIO=jetbrains; break;;
3 ) SCENARIO=vscode; break;;
* ) echo "Please answer 1 or 2 or 3";;
esac
done
if [ -z "${SCENARIO}" ]; then
echo -e "${BLUE}Choose the dedicated scenario to run the validation test suite.${NC}\n1-sshd\n2-jetbrains\n3-vscode"
while true; do
read -p "(1/2/3)? : " scenario
case $scenario in
1 ) SCENARIO=sshd; break;;
2 ) SCENARIO=jetbrains; break;;
3 ) SCENARIO=vscode; break;;
* ) echo "Please answer 1 or 2 or 3";;
esac
done
fi

# Read values from scenario's setting
. settings/settings-${SCENARIO}.env
Expand Down