v0.11.3
All checks were successful
ci/woodpecker/push/publish-docs Pipeline was successful
ci/woodpecker/tag/gitea Pipeline was successful
ci/woodpecker/tag/publish-docs Pipeline was successful
ci/woodpecker/release/publish-docs Pipeline was successful

This commit is contained in:
2026-01-31 01:06:18 -06:00
parent 995e4f91b5
commit 765ef2ee36
28 changed files with 873 additions and 69 deletions

12
tests/FileOps.yml Normal file
View File

@@ -0,0 +1,12 @@
commands:
copyFile:
type: file
fileOperation: copy
source: /home/andrew/Projects/backy/tests/data/fileops/source.txt
destination: /home/andrew/Projects/backy/tests/data/fileops/destination.txt
copyRemoteFile:
type: file
fileOperation: copy
sourceType: rempte
source: ssh://backy@localhost:2222/home/backy/remote_source.txt
destination: /home/andrew/Projects/backy/tests/data/fileops/remote_destination.txt

View File

@@ -10,7 +10,8 @@ commands:
successCmd:
name: get docker version
cmd: docker
getOutput: true
outputToLog: true
output:
file: docker_version_success.txt
toLog: true
Args:
- "-v"

View File

@@ -0,0 +1 @@
This is some test data.

View File

@@ -0,0 +1 @@
This is some test data.

39
tests/docker/README.md Normal file
View File

@@ -0,0 +1,39 @@
SSH test container
==================
This folder contains a simple Docker-based SSH server used for integration tests.
Quick start
-----------
Start the container (builds image if needed):
```bash
./start.sh
```
Stop the container:
```bash
./stop.sh
```
Access
------
- SSH endpoint: `localhost:2222`
- Test user: `backy` with password `backy` (password auth enabled)
- Root user: `root` with password `test`
- Public key `backytest.pub` is installed for both `backy` and `root`
Running tests
-------------
1. Start the container (`./start.sh`).
2. From the repo root, run your tests (example):
```bash
GO_TEST_SSH_ADDR=localhost:2222 go test ./... -v
```
If your tests rely on an SSH private key, use `tests/docker/backytest` as the private key and restrict access appropriately.

View File

@@ -1,4 +1,11 @@
cd ~/Projects/backy/tests/docker
docker container rm -f ssh_server_container
docker build -t ssh_server_image .
docker run -d -p 2222:22 --name ssh_server_container ssh_server_image
#!/usr/bin/env bash
set -euo pipefail
# Build and run the test SSH container from the tests/docker directory
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
docker container rm -f ssh_server_container 2>/dev/null || true
docker build -t ssh_server_image "$SCRIPT_DIR"
docker run -d -p 2222:22 --name ssh_server_container ssh_server_image
sleep 5
ssh-keyscan -p 2222 localhost > $SCRIPT_DIR/known_hosts

8
tests/docker/compose.yml Normal file
View File

@@ -0,0 +1,8 @@
services:
ssh_server:
build: .
image: backy_ssh_server:latest
container_name: backy_ssh_server
ports:
- "2222:22"
restart: "no"

8
tests/docker/known_hosts Normal file
View File

@@ -0,0 +1,8 @@
# localhost:2222 SSH-2.0-OpenSSH_9.6p1 Ubuntu-3ubuntu13.14
# localhost:2222 SSH-2.0-OpenSSH_9.6p1 Ubuntu-3ubuntu13.14
[localhost]:2222 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDATufWA1HRnNayIQLjSpA2+P9N6h0WF+jP+abMaINlZkiHFnFVDAoqD5/onVXymskrgQaKEYmBOs+Kv0t+Acvdor2IcvYgFueSm+jkslpSK/uuf1mx0gVJO77S2BIjqyWtUzVv96Iy4Gjt2RsrnalgYNYmi3OyPkG0IUA+3Im+2gztSECCy+nW3R/vaoPLwr4kImpLlrijcSHc4mHOY6BurrcWKNuGrsvTAOKgUZqlya6uDd+yD7fUfsmL1MqBKwZqfP3JAdp/Dd+laNNGcvEM4WhzYFSPfhqblewD0rjbto9MSOSXLyQz5RPmdITj/m5M4lj2ECmcI2gzraDMoj8ZkuJAss50oX6fmVUZestN5jlz7Y7XKEvXuH8qfLHKwaOUTZlcGbfAMz6uSrh8DNT6KzRG4j5nZ9Z5pTn1huz/p6jnJUGuHt2Ez3EK+isM+sHS6TntXavIkebaq7ErcBCO8A1fZFZlhlHoI9o9W62tMY7gbtlGodW8dKxK89+1a88=
# localhost:2222 SSH-2.0-OpenSSH_9.6p1 Ubuntu-3ubuntu13.14
[localhost]:2222 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBK9fEYfiGGgu0Eh7X2JT4jR4+utcfpm6Ee+Cer1x/XbMHzCPZg6YmYy6OaCSms/0VJ/QWxD+0HlsO7sqO5oeO60=
# localhost:2222 SSH-2.0-OpenSSH_9.6p1 Ubuntu-3ubuntu13.14
[localhost]:2222 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKT5+Cbi/ynOAPzwv0IaOVBtGFYtW33LIvNUuBKYqqyJ
# localhost:2222 SSH-2.0-OpenSSH_9.6p1 Ubuntu-3ubuntu13.14

7
tests/docker/start.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/usr/bin/env bash
set -euo pipefail
DIR="$(cd "$(dirname "$0")" && pwd)"
echo "Starting SSH test container (building if needed)..."
docker compose -f "$DIR/compose.yml" up -d --build
echo "Container started on localhost:2222"

7
tests/docker/stop.sh Executable file
View File

@@ -0,0 +1,7 @@
#!/usr/bin/env bash
set -euo pipefail
DIR="$(cd "$(dirname "$0")" && pwd)"
echo "Stopping and removing SSH test container..."
docker compose -f "$DIR/compose.yml" down --remove-orphans
echo "Stopped."

5
tests/example.tmpl Normal file
View File

@@ -0,0 +1,5 @@
{{ .greeting }}, {{ .name }}!
port: {{ .port | default "8080" }}
envHOME: {{ env "HOME" "" }}
debugYaml:
{{ toYaml . }}

3
tests/vars.yaml Normal file
View File

@@ -0,0 +1,3 @@
name: Alice
greeting: Hello
port: 9090