Skip to content

Commit

Permalink
Update docs and docker tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gcotelli committed Apr 18, 2024
1 parent 8707ffd commit f04e783
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 1 deletion.
22 changes: 22 additions & 0 deletions .docker/gs64/docker-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,16 @@ function assertOutputIncludesMessage() {
fi
}

function assertOutputIsEmpty() {
local output=$1

if [ -s "$output" ];then
print_error "Expected std$output to be empty when invoked with $LAST_ARGUMENTS"
cat "$output"
exit 1
fi
}

set -e

if [ $# -eq 0 ]; then
Expand Down Expand Up @@ -144,13 +154,25 @@ assertOutputIncludesMessage "\[ERROR\] \"Name\" parameter not provided. You must
print_success " Missing name, OK"
run_launchpad_gem launchpad start greeter
assertOutputIncludesMessage "\[ERROR\] \"Name\" parameter not provided. You must provide one." err
print_success " Missing name and title, OK"

run_launchpad_gem launchpad start --dry-run greeter --name=Juan --title=Mr
assertOutputIsEmpty err
print_success " Dry run with valid parameters, OK"
run_launchpad_gem launchpad start --dry-run greeter
assertOutputIncludesMessage "\[ERROR\] \"Name\" parameter not provided. You must provide one." err
print_success " Dry run with missing parameters, OK"
print_success "OK"

print_info "Running launchpad start broken test"
run_launchpad_gem launchpad start broken --raise-error
assertOutputIncludesMessage "\[INFO\] Obtaining configuration... \[DONE\]" out
assertOutputIncludesMessage "\[ERROR\] Unexpected startup error: \"Doh!\"" err
print_success "OK"
run_launchpad_gem launchpad start --dry-run broken --raise-error
assertOutputIsEmpty err
assertOutputIncludesMessage "\[INFO\] Obtaining configuration... \[DONE\]" out
print_success "Dry run, OK"

print_info "Stopping stone"
docker stop gs64-stone
Expand Down
21 changes: 21 additions & 0 deletions .docker/pharo/docker-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,16 @@ function assertOutputIncludesMessage() {
fi
}

function assertOutputIsEmpty() {
local output=$1

if [ -s "$output" ];then
print_error "Expected std$output to be empty when invoked with $LAST_ARGUMENTS"
cat "$output"
exit 1
fi
}

set -e

print_info "Building base image"
Expand Down Expand Up @@ -108,13 +118,24 @@ assertOutputIncludesMessage "\[ERROR\] \"Name\" parameter not provided. You must
print_success " Missing name, OK"
executeWithArguments docker run launchpad-examples:sut launchpad-start greeter
assertOutputIncludesMessage "\[ERROR\] \"Name\" parameter not provided. You must provide one." err
print_success " Missing name and title, OK"
executeWithArguments docker run launchpad-examples:sut launchpad-start --dry-run greeter --name=Juan --title=Mr
assertOutputIsEmpty err
print_success " Dry run with valid parameters, OK"
executeWithArguments docker run launchpad-examples:sut launchpad-start --dry-run greeter
assertOutputIncludesMessage "\[ERROR\] \"Name\" parameter not provided. You must provide one." err
print_success " Dry run with missing parameters, OK"
print_success "OK"

print_info "Running launchpad-start broken test"
executeWithArguments docker run launchpad-examples:sut launchpad-start broken --raise-error
assertOutputIncludesMessage "\[INFO\] Obtaining configuration... \[DONE\]" out
assertOutputIncludesMessage "\[ERROR\] Unexpected startup error: \"Doh!\"" err
print_success "OK"
executeWithArguments docker run launchpad-examples:sut launchpad-start --dry-run broken --raise-error
assertOutputIsEmpty err
assertOutputIncludesMessage "\[INFO\] Obtaining configuration... \[DONE\]" out
print_success "Dry run, OK"

print_info "Running launchpad-start command server test"
# broken app keeps running when passed and invalid option
Expand Down
9 changes: 8 additions & 1 deletion docs/reference/CLI.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ The `start` sub-command will start the selected application.
launchpad start [--help|-h] [--debug-mode] [--settings-file=<filename>]
[--enable-tcp-command-server=<listeningPort>]
[--enable-structured-logging]
[--dry-run]
<app> [<parameters>]
```

Expand Down Expand Up @@ -247,7 +248,7 @@ $ launchpad start greeter
launchpad-start - Start the selected application
SYNOPSYS
launchpad start [--help|-h] [--debug-mode]
[--settings-file=<filename>] <app> [<parameters>]
[--settings-file=<filename>] [--dry-run] <app> [<parameters>]
DESCRIPTION
Start the application selected via <app>.

Expand All @@ -268,6 +269,10 @@ $ launchpad start greeter
This option can occur several times to configure more
than one settings file. Supported file settings formats
are INI and JSON.
--dry-run
Perform a dry run of the application.
All the configuration will be loaded (and validated),
but the application will not perform any changes.
```

- `debug-mode` Enable the debugging mode.
Expand All @@ -290,3 +295,5 @@ $ launchpad start greeter
can be used to send commands controlling the application using a TCP port.
- `--enable-structured-logging` Enable structured logging. When enabled the log
will be emitted in JSON format.
- `--dry-run` Perform a dry run of the application. All the configuration will
be loaded (and validated), but the application will not perform any changes.

0 comments on commit f04e783

Please sign in to comment.