mirror of
https://github.com/dredx/prole.git
synced 2026-09-27 11:24:30 +00:00
- Introduce lib/shell helpers and keep etc/* scripts thin via compatibility shims - Move Kerberos validation to scripts/validation/check_kerberos.sh and update callers - Add deterministic shellspec unit tests under tests/shellspec/ and wire Maven to run them - Add minimal Spring Boot authority module with startup + /health endpoint and Maven wiring - Document the new layout in docs/layout.md Co-authored-by: Junie <junie@jetbrains.com>
76 lines
2.5 KiB
Bash
76 lines
2.5 KiB
Bash
#shellcheck shell=sh disable=SC2016
|
|
|
|
% FIXTURE: "$SHELLSPEC_HELPERDIR/fixture"
|
|
% FILE: "$SHELLSPEC_TMPBASE/status"
|
|
|
|
Describe "shellspec-precheck.sh"
|
|
create_status_file() {
|
|
echo "$1" > "$FILE"
|
|
}
|
|
|
|
Context "when the precheck callback succeeds"
|
|
Before 'export MODE=success'
|
|
Before 'create_status_file 100'
|
|
It 'loads env file'
|
|
When run script ./libexec/shellspec-prechecker.sh --status-file="$FILE" "$FIXTURE/precheck.sh" "$FIXTURE/empty"
|
|
The output should eq "precheck"
|
|
The status should be success
|
|
The contents of file "$FILE" should be blank
|
|
End
|
|
End
|
|
|
|
Context "when the precheck callback return zero"
|
|
Before 'export MODE=return:0'
|
|
Before 'create_status_file 100'
|
|
It 'loads env file'
|
|
When run script ./libexec/shellspec-prechecker.sh --status-file="$FILE" "$FIXTURE/precheck.sh" "$FIXTURE/empty"
|
|
The output should eq "precheck"
|
|
The status should eq 0
|
|
The contents of file "$FILE" should be blank
|
|
End
|
|
End
|
|
|
|
Context "when the precheck callback return non-zero"
|
|
Before 'export MODE=return:2'
|
|
It 'loads env file'
|
|
When run script ./libexec/shellspec-prechecker.sh --status-file="$FILE" "$FIXTURE/precheck.sh" "$FIXTURE/empty"
|
|
The output should eq "precheck"
|
|
The status should eq 2
|
|
The contents of file "$FILE" should eq 2
|
|
End
|
|
End
|
|
|
|
Context "when the precheck callback exits zero"
|
|
Before 'export MODE=exit:0'
|
|
Before 'create_status_file 100'
|
|
It 'loads env file'
|
|
When run script ./libexec/shellspec-prechecker.sh --status-file="$FILE" "$FIXTURE/precheck.sh" "$FIXTURE/empty"
|
|
The output should eq "precheck"
|
|
The status should eq 0
|
|
The contents of file "$FILE" should eq 0
|
|
End
|
|
End
|
|
|
|
Context "when the precheck callback exits non-zero"
|
|
Before 'export MODE=exit:3'
|
|
It 'loads env file'
|
|
When run script ./libexec/shellspec-prechecker.sh --status-file="$FILE" "$FIXTURE/precheck.sh" "$FIXTURE/empty"
|
|
The output should eq "precheck"
|
|
The status should eq 3
|
|
The contents of file "$FILE" should eq 3
|
|
End
|
|
End
|
|
|
|
Context "when an error occurs"
|
|
Before 'export MODE=abort:127'
|
|
Before 'create_status_file 100'
|
|
It 'loads env file'
|
|
When run script ./libexec/shellspec-prechecker.sh --status-file="$FILE" --warn-fd=1 "$FIXTURE/precheck.sh" "$FIXTURE/empty"
|
|
The output should include "precheck_loaded"
|
|
The status should be failure
|
|
The contents of file "$FILE" should be blank
|
|
# The contents of file "$FILE" should eq 127 # abort in the future
|
|
End
|
|
End
|
|
End
|