Skip to content

Fix test suite issues #65

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jun 15, 2025
Merged
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
10 changes: 6 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@ on:
jobs:
e2e_tests:
name: end to end tests
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
strategy:
matrix:
phpipam-version: ['v1.4x', 'v1.5x']
python-version: ['3.7.x', '3.8.x', '3.9.x', '3.10.x']
phpipam-version: ['v1.4x', 'v1.5x', 'v1.6x', 'v1.7x']
python-version: ['3.9.x', '3.10.x', '3.11.x', '3.12.0', '3.13.0']
steps:
- name: Upgrade docker-compose
run: sudo apt-get install --upgrade docker-compose
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: setup phpipam
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ changelog-cli
flake8
flake8-colors
flake8-docstrings
requests >=2.31,<3.0
requests
inflection
twine
setuptools
Expand Down
2 changes: 2 additions & 0 deletions tests/docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ services:
IPAM_DATABASE_NAME: "phpipam"
depends_on:
- database
container_name: phpipam_test_webserver
database:
image: mariadb:10.3.18
ports:
Expand All @@ -20,3 +21,4 @@ services:
MYSQL_USER: "phpipam"
MYSQL_PASSWORD: "phpipamadmin"
MYSQL_DATABASE: "phpipam"
container_name: phpipam_test_db
8 changes: 4 additions & 4 deletions tests/docker/setup_database.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ function info() {

MYSQL_PING="mysqladmin ping -h ${DB_HOST:-127.0.0.1} -P ${DB_PORT:-3306} -u ${MYSQL_ROOT_USER:-root} -p${MYSQL_ROOT_PASSWORD:-rootpw}"

if grep -q podman <<< $(docker --version 2> /dev/null) ; then
if grep -qi podman <<< $(docker version 2> /dev/null) ; then
info "Podman is installed"
DOCKER_CMD=$(which podman)
fi

if "${DOCKER_CMD}" ps | grep -q docker_phpipam_1 && ! eval "${MYSQL_PING}" ; then
if "${DOCKER_CMD}" ps | grep -q phpipam_test_webserver && ! eval "${MYSQL_PING}" ; then

info -n "Waiting for database connection "
while ! eval "${MYSQL_PING}" ; do
Expand All @@ -26,10 +26,10 @@ fi

info "Database is up"

if [[ $(mysqlshow -u root -prootpw -h 127.0.0.1 -P 3306 phpipam | wc -l) -eq 5 ]] ; then
if [[ $(mysqlshow -u root -prootpw -h 127.0.0.1 -P 3306 phpipam 2>/dev/null | wc -l) -eq 5 ]] ; then

info "Creating database ${DB_NAME:-phpipam}"
${DOCKER_CMD} exec -ti docker_phpipam_1 sh -c 'mysql -h database -u phpipam -pphpipamadmin phpipam < /phpipam/db/SCHEMA.sql' && ((init_result++))
${DOCKER_CMD} exec -t phpipam_test_webserver sh -c 'mysql -h database -u phpipam -pphpipamadmin phpipam < /phpipam/db/SCHEMA.sql' && ((init_result++))

info "Activating API"
mysql -u phpipam -pphpipamadmin -h "${DB_HOST:-127.0.0.1}" phpipam --execute="UPDATE settings SET api=1 WHERE id=1;" && ((init_result++))
Expand Down