tests: beginning of tests using Docker

This commit is contained in:
2025-07-04 09:02:27 -05:00
parent 7be2679b91
commit 305b504ca1
52 changed files with 1423 additions and 521 deletions

View File

@ -2,10 +2,18 @@ commands:
echoTestFail:
cmd: ech
shell: bash
Args: hello world
Args:
- hello world
hooks:
error:
- errorCmd
final:
- finalCmd
finalCmd:
cmd: echo
Args:
- "echo test fail"
errorCmd:
name: get docker version
@ -14,4 +22,11 @@ commands:
outputToLog: true
Args:
- "-v"
host: email-svr
host: email-svr
cmdLists:
TestHooks:
output:
onFailure: true
order:
- echoTestFail

26
tests/docker/Dockerfile Normal file
View File

@ -0,0 +1,26 @@
FROM debian:buster
# Install SSH server
RUN apt-get update && \
apt-get install -y openssh-server && \
apt-get clean
RUN sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
RUN sed -i 's/#PasswordAuthentication yes/PasswordAuthentication yes/' /etc/ssh/sshd_config
RUN useradd -m -s /bin/bash backy
RUN echo "backy:backy" | chpasswd
RUN echo "root:test" | chpasswd
COPY --chown=backy:backy backytest.pub /home/backy/.ssh/authorized_keys
COPY --chown=root:root backytest.pub /root/.ssh/authorized_keys
EXPOSE 22
RUN mkdir /var/run/sshd
RUN chmod 0755 /var/run/sshd
# RUN apt-get update && apt-get install -y
# Start SSH service
CMD ["/usr/sbin/sshd", "-D"]
# ENTRYPOINT service ssh start && bash

7
tests/docker/backytest Normal file
View File

@ -0,0 +1,7 @@
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW
QyNTUxOQAAACBtBASN+HMx/EVUIs5ThK9Nlw0wPFVt2rXsiNZlDN+CswAAAKAfFc5AHxXO
QAAAAAtzc2gtZWQyNTUxOQAAACBtBASN+HMx/EVUIs5ThK9Nlw0wPFVt2rXsiNZlDN+Csw
AAAEAxs6uRkenVbXPrjgbIv/1THXL6dUdgr5KaCd7uBVm0PW0EBI34czH8RVQizlOEr02X
DTA8VW3ateyI1mUM34KzAAAAGU1lZGlhIHVzZXIgc3RvcmFnZSBzZXJ2ZXIBAgME
-----END OPENSSH PRIVATE KEY-----

View File

@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIG0EBI34czH8RVQizlOEr02XDTA8VW3ateyI1mUM34Kz Backy test

3
tests/docker/buildDocker.sh Executable file
View File

@ -0,0 +1,3 @@
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

6
tests/hosts.yml Normal file
View File

@ -0,0 +1,6 @@
hosts:
docker:
port: 2222
Hostname: localhost
user: backy
IdentityFile: ./docker/backytest

53
tests/packageCommands.yml Normal file
View File

@ -0,0 +1,53 @@
commands:
checkDockerNoVersion:
type: package
shell: zsh
packages:
- name: "docker-ce-cli"
- name: "docker-ce"
packageManager: apt
packageOperation: checkVersion
checkDockerPartialVersionWithoutRegex:
type: package
shell: zsh
packages:
- name: "docker-ce-cli"
version: "5:28.0.4-1"
- name: "docker-ce"
version: "5:28.0.4-1"
packageManager: apt
packageOperation: checkVersion
checkDockerPartialVersionWithRegex:
type: package
shell: zsh
packages:
- name: "docker-ce-cli"
version: "5:28.0-*"
- name: "docker-ce"
version: '5:28\.0\.4-1~([A-Za-z0-9]+(\.[A-Za-z0-9]+)+)*'
packageManager: apt
packageOperation: checkVersion
checkDockerVersionWithInvalidRegex:
type: package
shell: zsh
packages:
- name: "docker-ce-cli"
version: "5:28.0-**"
- name: "docker-ce"
version: '5:28\.0\K.4-1~([A-Za-z0-9]+(\.[A-Za-z0-9]+)+)*'
packageManager: apt
packageOperation: checkVersion
# host: mail.andrewnw.com
cmdLists:
packageCommands:
output:
onFailure: true
order:
- checkDockerPartialVersionWithoutRegex
- checkDockerPartialVersionWithRegex
- checkDockerVersionWithInvalidRegex
- checkDockerNoVersion

View File

@ -0,0 +1,52 @@
commands:
checkDockerNoVersion:
type: package
shell: zsh
packages:
- name: "docker-ce-cli"
- name: "docker-ce"
packageManager: dnf
packageOperation: checkVersion
checkDockerPartialVersionWithoutRegex:
type: package
shell: zsh
packages:
- name: "docker-ce-cli"
version: "5:28.0.4-1"
- name: "docker-ce"
version: "5:28.0.4-1"
packageManager: dnf
packageOperation: checkVersion
checkDockerPartialVersionWithRegex:
type: package
shell: zsh
packages:
- name: "docker-ce-cli"
version: "5:28.0-*"
- name: "docker-ce"
version: '5:28\.0\.4-1~([A-Za-z0-9]+(\.[A-Za-z0-9]+)+)*'
packageManager: dnf
packageOperation: checkVersion
checkDockerVersionWithInvalidRegex:
type: package
shell: zsh
packages:
- name: "docker-ce-cli"
version: "5:28.0-**"
- name: "docker-ce"
version: '5:28\.0\K.4-1~([A-Za-z0-9]+(\.[A-Za-z0-9]+)+)*'
packageManager: dnf
packageOperation: checkVersion
cmdLists:
packageCommands:
output:
onFailure: true
order:
- checkDockerPartialVersionWithoutRegex
- checkDockerPartialVersionWithRegex
- checkDockerVersionWithInvalidRegex
- checkDockerNoVersion