add e2e test
This commit is contained in:
40
.gitea/workflows/e2e-test.yml
Normal file
40
.gitea/workflows/e2e-test.yml
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
name: E2E Test
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
e2e-test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Build Docker image
|
||||||
|
run: docker build -t ssh-server-test .
|
||||||
|
|
||||||
|
- name: Run SSH server
|
||||||
|
run: |
|
||||||
|
docker run -d --name ssh-server-test -p 2222:22 -e COMMAND="echo 'SSH connection successful'" ssh-server-test
|
||||||
|
|
||||||
|
- name: Wait for server to start
|
||||||
|
run: sleep 5
|
||||||
|
|
||||||
|
- name: Test SSH connection
|
||||||
|
run: |
|
||||||
|
output=$(ssh -p 2222 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null root@localhost "echo test")
|
||||||
|
if [ "$output" = "test" ]; then
|
||||||
|
echo "SSH connection test passed"
|
||||||
|
else
|
||||||
|
echo "SSH connection test failed"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Cleanup
|
||||||
|
run: docker stop ssh-server-test
|
||||||
Reference in New Issue
Block a user