mirror of
https://github.com/Burnett01/rsync-deployments.git
synced 2025-09-06 02:26:02 -06:00
Add bats tests (#76)
Some checks failed
CI / Test BATS Suite (push) Has been cancelled
CI / Validate Action Definition (push) Has been cancelled
CI / Validate Action Structure (push) Has been cancelled
CI / Lint Shell Scripts (push) Has been cancelled
CI / Build Docker Image (push) Has been cancelled
CI / Integration Check (push) Has been cancelled
Some checks failed
CI / Test BATS Suite (push) Has been cancelled
CI / Validate Action Definition (push) Has been cancelled
CI / Validate Action Structure (push) Has been cancelled
CI / Lint Shell Scripts (push) Has been cancelled
CI / Build Docker Image (push) Has been cancelled
CI / Integration Check (push) Has been cancelled
* Add Bats tests and workflow for entrypoint.sh * Add Bats tests and workflow * Add comprehensive GitHub Actions CI workflow (#77) * Initial plan * Add comprehensive GitHub Actions CI workflow Co-authored-by: Burnett01 <1208707+Burnett01@users.noreply.github.com> * Enhance CI workflow with job dependencies and documentation Co-authored-by: Burnett01 <1208707+Burnett01@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Burnett01 <1208707+Burnett01@users.noreply.github.com> * Update CI workflow to only include master branch --------- Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
This commit is contained in:
parent
33214bd98b
commit
53581dff6d
2 changed files with 228 additions and 0 deletions
65
test/entrypoint.bats
Normal file
65
test/entrypoint.bats
Normal file
|
@ -0,0 +1,65 @@
|
|||
#!/usr/bin/env bats
|
||||
|
||||
setup() {
|
||||
# Create a dummy ssh agent and agent-add for sourcing
|
||||
echo 'echo "agent started"' > agent-start
|
||||
echo 'echo "key added"' > agent-add
|
||||
chmod +x agent-start agent-add
|
||||
|
||||
# Create a dummy rsync to capture its arguments
|
||||
echo 'echo "rsync $@"' > rsync
|
||||
chmod +x rsync
|
||||
|
||||
PATH="$PWD:$PATH"
|
||||
}
|
||||
|
||||
teardown() {
|
||||
rm -f agent-start agent-add rsync
|
||||
}
|
||||
|
||||
@test "fails if INPUT_REMOTE_PATH is empty" {
|
||||
export INPUT_REMOTE_PATH=" "
|
||||
run ./entrypoint.sh
|
||||
[ "$status" -eq 1 ]
|
||||
[[ "${output}" == *"can not be empty"* ]]
|
||||
}
|
||||
|
||||
@test "includes legacy RSA switches when allowed" {
|
||||
export INPUT_LEGACY_ALLOW_RSA_HOSTKEYS="true"
|
||||
export INPUT_REMOTE_PATH="remote/"
|
||||
export INPUT_REMOTE_KEY="dummy"
|
||||
export INPUT_REMOTE_KEY_PASS="dummy"
|
||||
export GITHUB_ACTION="dummy"
|
||||
export INPUT_SWITCHES="-avz"
|
||||
export INPUT_REMOTE_PORT="22"
|
||||
export INPUT_RSH=""
|
||||
export INPUT_PATH=""
|
||||
export INPUT_REMOTE_USER="user"
|
||||
export INPUT_REMOTE_HOST="host"
|
||||
export GITHUB_WORKSPACE="/tmp"
|
||||
export DSN="user@host"
|
||||
export LOCAL_PATH="/tmp/"
|
||||
|
||||
run ./entrypoint.sh
|
||||
[[ "${output}" == *"HostKeyAlgorithms=+ssh-rsa"* ]]
|
||||
}
|
||||
|
||||
@test "does not include legacy RSA switches when not allowed" {
|
||||
export INPUT_LEGACY_ALLOW_RSA_HOSTKEYS="false"
|
||||
export INPUT_REMOTE_PATH="remote/"
|
||||
export INPUT_REMOTE_KEY="dummy"
|
||||
export INPUT_REMOTE_KEY_PASS="dummy"
|
||||
export GITHUB_ACTION="dummy"
|
||||
export INPUT_SWITCHES="-avz"
|
||||
export INPUT_REMOTE_PORT="22"
|
||||
export INPUT_RSH=""
|
||||
export INPUT_PATH=""
|
||||
export INPUT_REMOTE_USER="user"
|
||||
export INPUT_REMOTE_HOST="host"
|
||||
export GITHUB_WORKSPACE="/tmp"
|
||||
export DSN="user@host"
|
||||
export LOCAL_PATH="/tmp/"
|
||||
|
||||
run ./entrypoint.sh
|
||||
[[ "${output}" != *"HostKeyAlgorithms=+ssh-rsa"* ]]
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue