Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 20 additions & 16 deletions .github/workflows/database.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,43 @@
name: Test tunnel for databases connection

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
types: [opened, synchronize, reopened]
push:
branches: [master]

jobs:
build:

runs-on: ubuntu-18.04
runs-on: ubuntu-latest

strategy:
matrix:
python: [python2, python3]
python-version: ['2.7', '3.8', '3.9', '3.10', '3.11']

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Docker compose up databases and ssh-server
run: cd e2e_tests && docker-compose up -d
run: |
chmod -R 777 ./e2e_tests/ssh-server-config
cd e2e_tests && docker-compose up -d
- name: Install dependencies
run: |
uname -a
lsb_release -a
${{ matrix.python }} -V
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
${{ matrix.python }} get-pip.py
${{ matrix.python }} -m pip install --upgrade pip
${{ matrix.python }} -m pip install .
${{ matrix.python }} -m pip install psycopg2 pymysql pymongo
python -V
python -m pip install --upgrade pip
python -m pip install .
python -m pip install psycopg2 pymysql pymongo
# cd e2e_tests && docker-compose logs ssh; cd ..
# cd e2e_tests && docker-compose exec ssh cat /config/logs/openssh/current; cd ..
chmod 600 ./e2e_tests/ssh-server-config/ssh_host_rsa_key
# ssh -o "StrictHostKeyChecking=no" linuxserver@127.0.0.1 -p 2223 -i ./e2e_tests/ssh-server-config/ssh_host_rsa_key -v "uname -a"
- name: Run db tests ${{ matrix.python }}
run: ${{ matrix.python }} e2e_tests/run_docker_e2e_db_tests.py
- name: Run hungs tests ${{ matrix.python }}
run: timeout 10s ${{ matrix.python }} e2e_tests/run_docker_e2e_hangs_tests.py
- name: Run db tests ${{ matrix.python-version }}
run: python e2e_tests/run_docker_e2e_db_tests.py
- name: Run hungs tests ${{ matrix.python-version }}
run: timeout 10s python e2e_tests/run_docker_e2e_hangs_tests.py
6 changes: 3 additions & 3 deletions e2e_tests/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
version: "2.1"
services:
ssh:
image: ghcr.io/linuxserver/openssh-server
image: ghcr.io/linuxserver/openssh-server:9.1_p1-r2-ls106
container_name: openssh-server
hostname: openssh-server
environment:
Expand Down Expand Up @@ -31,7 +31,7 @@ services:
ipv4_address: 10.5.0.5

mysqldb:
image: mysql:8
image: mysql:8.0.22
environment:
MYSQL_DATABASE: main
MYSQL_USER: mysql
Expand All @@ -42,7 +42,7 @@ services:
ipv4_address: 10.5.0.6

mongodb:
image: mongo:3.6
image: mongo:3.6.21
environment:
MONGO_INITDB_ROOT_USERNAME: mongo
MONGO_INITDB_ROOT_PASSWORD: mongo
Expand Down
8 changes: 7 additions & 1 deletion e2e_tests/run_docker_e2e_db_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,5 +237,11 @@ def show_threading_state_if_required():
wait_and_check_or_restart_if_required(tunnel)
show_threading_state_if_required()
logging.warning('EOF')

assert res == (PG_EXPECT, MYSQL_EXPECT, MONGO_EXPECT)

# If Python 2.7 is dropped below makes debugging easier!
# assert res[0] == PG_EXPECT, f"{res[0]=} {PG_EXPECT}"
# assert res[1] == MYSQL_EXPECT, f"{res[1]=} {MYSQL_EXPECT}"
# assert res[2] == MONGO_EXPECT, f"{res[2]=} {MONGO_EXPECT}"
logging.info("Tests pass!")