Skip to content

Commit

Permalink
Fix errors in GH action coverage test (qgis#323)
Browse files Browse the repository at this point in the history
* Fix test error in GH actions.

* Revert test.yaml, update tests, install freezegun, update requirements

* Delete volume in docker-compose

* Specify commit for whoosh and version for freezgun
  • Loading branch information
Xpirix authored Dec 8, 2023
1 parent b661773 commit 6589e3c
Show file tree
Hide file tree
Showing 8 changed files with 151 additions and 125 deletions.
10 changes: 7 additions & 3 deletions REQUIREMENTS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ Markdown==2.3.1
#PIL==1.1.7
Pillow
Pygments==2.7.4
Whoosh==2.5.6

# Updates for Django 2 & Python 3.7
git+https://github.com/Xpirix/whoosh.git@a306553
pickle5==0.0.12
django-haystack==3.2.1

argparse==1.2.1
#cab==0.2.0 # Not used anymore..-
#distribute==0.7.3
Expand All @@ -20,7 +25,6 @@ django-debug-toolbar==1.11.1
django-endless-pagination==2.0
django-extensions==1.2.0
django-generic-aggregation==0.3.2
django-haystack==2.4.0
#django-olwidget==0.61.0 unmaintained, use this fork
git+https://github.com/Christophe31/olwidget.git
django-pagination==1.0.7
Expand All @@ -30,7 +34,7 @@ git+https://github.com/enikesha/django-ratings.git
django-simple-ratings==0.3.2
# SIMPLEMENU
git+https://github.com/elpaso/django-simplemenu.git
django-taggit==0.14.0
django-taggit==2.0.0
django-taggit-autosuggest==0.2.7
django-taggit-templatetags==0.4.6dev0
django-templatetag-sugar==0.1
Expand Down
226 changes: 114 additions & 112 deletions dockerize/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,117 +1,119 @@
db:
container_name: qgis-plugins-db
image: kartoza/postgis:9.6-2.4
environment:
- ALLOW_IP_RANGE=0.0.0.0/0
- POSTGRES_USER=docker
- POSTGRES_PASS=docker
volumes:
- ./backups:/backups
restart: unless-stopped
version: "3.8"
services:
db:
container_name: qgis-plugins-db
image: kartoza/postgis:9.6-2.4
environment:
- ALLOW_IP_RANGE=0.0.0.0/0
- POSTGRES_USER=docker
- POSTGRES_PASS=docker
volumes:
- ./backups:/backups
restart: unless-stopped

web:
# Note you cannot scale if you use container_name
container_name: qgis-plugins-web
build: docker
hostname: uwsgi
environment:
- DATABASE_NAME=gis
- DATABASE_USERNAME=docker
- DATABASE_PASSWORD=docker
- DATABASE_HOST=db
- DJANGO_SETTINGS_MODULE=settings_docker
- VIRTUAL_HOST=plugins.kartoza.com
- VIRTUAL_PORT=8080
- DEBUG=False
- RABBITMQ_HOST=rabbitmq
volumes:
- ../qgis-app:/home/web/django_project
- ./static:/home/web/static:rw
- ./static:/home/web/media:rw
links:
- db:db
- rabbitmq:rabbitmq
- worker:worker
restart: unless-stopped
user: root
command: uwsgi --ini /uwsgi.conf
web:
# Note you cannot scale if you use container_name
container_name: qgis-plugins-web
build: docker
hostname: uwsgi
environment:
- DATABASE_NAME=gis
- DATABASE_USERNAME=docker
- DATABASE_PASSWORD=docker
- DATABASE_HOST=db
- DJANGO_SETTINGS_MODULE=settings_docker
- VIRTUAL_HOST=plugins.kartoza.com
- VIRTUAL_PORT=8080
- DEBUG=False
- RABBITMQ_HOST=rabbitmq
volumes:
- ../qgis-app:/home/web/django_project
- ./static:/home/web/static:rw
- ./static:/home/web/media:rw
links:
- db:db
- rabbitmq:rabbitmq
- worker:worker
restart: unless-stopped
user: root
command: uwsgi --ini /uwsgi.conf

devweb:
# Note you cannot scale if you use container_name
container_name: qgis-plugins-devweb
build: docker
hostname: uwsgi
environment:
- DATABASE_NAME=gis
- DATABASE_USERNAME=docker
- DATABASE_PASSWORD=docker
- DATABASE_HOST=db
- DJANGO_SETTINGS_MODULE=settings_docker
- VIRTUAL_HOST=plugins.kartoza.com
- VIRTUAL_PORT=8080
- RABBITMQ_HOST=rabbitmq
volumes:
- ../qgis-app:/home/web/django_project
- ./static:/home/web/static:rw
- ./static:/home/web/media:rw
links:
- db:db
- rabbitmq:rabbitmq
- worker:worker
restart: unless-stopped
user: root
ports:
# for django test server
- "62202:8080"
# for ssh
- "62203:22"
devweb:
# Note you cannot scale if you use container_name
container_name: qgis-plugins-devweb
build: docker
hostname: uwsgi
environment:
- DATABASE_NAME=gis
- DATABASE_USERNAME=docker
- DATABASE_PASSWORD=docker
- DATABASE_HOST=db
- DJANGO_SETTINGS_MODULE=settings_docker
- VIRTUAL_HOST=plugins.kartoza.com
- VIRTUAL_PORT=8080
- RABBITMQ_HOST=rabbitmq
volumes:
- ../qgis-app:/home/web/django_project
- ./static:/home/web/static:rw
- ./static:/home/web/media:rw
links:
- db:db
- rabbitmq:rabbitmq
- worker:worker
restart: unless-stopped
user: root
ports:
# for django test server
- "62202:8080"
# for ssh
- "62203:22"

rabbitmq:
image: library/rabbitmq:3.6
hostname: rabbitmq
environment:
- RABBIT_PASSWORD=rabbit_test_password
- USER=rabbit_user
- RABBITMQ_NODENAME=rabbit
restart: unless-stopped
rabbitmq:
image: library/rabbitmq:3.6
hostname: rabbitmq
environment:
- RABBIT_PASSWORD=rabbit_test_password
- USER=rabbit_user
- RABBITMQ_NODENAME=rabbit
restart: unless-stopped

worker:
# Note you cannot scale if you use container_name
container_name: qgis-plugins-worker
build: docker
hostname: uwsgi
working_dir: /home/web/django_project
command: celery -A plugins worker -l info
environment:
- DATABASE_NAME=gis
- DATABASE_USERNAME=docker
- DATABASE_PASSWORD=docker
- DATABASE_HOST=db
- DJANGO_SETTINGS_MODULE=settings_docker
- VIRTUAL_HOST=plugins.kartoza.com
- VIRTUAL_PORT=8080
- RABBITMQ_HOST=rabbitmq
volumes:
- ../qgis-app:/home/web/django_project
- ./static:/home/web/static:rw
- ./static:/home/web/media:rw
links:
- db:db
- rabbitmq:rabbitmq
worker:
# Note you cannot scale if you use container_name
container_name: qgis-plugins-worker
build: docker
hostname: uwsgi
working_dir: /home/web/django_project
command: celery -A plugins worker -l info
environment:
- DATABASE_NAME=gis
- DATABASE_USERNAME=docker
- DATABASE_PASSWORD=docker
- DATABASE_HOST=db
- DJANGO_SETTINGS_MODULE=settings_docker
- VIRTUAL_HOST=plugins.kartoza.com
- VIRTUAL_PORT=8080
- RABBITMQ_HOST=rabbitmq
volumes:
- ../qgis-app:/home/web/django_project
- ./static:/home/web/static:rw
- ./static:/home/web/media:rw
links:
- db:db
- rabbitmq:rabbitmq

nginx:
# Note you cannot scale if you use container_name
container_name: qgis-plugins-nginx
image: nginx
hostname: nginx
volumes:
- ./sites-enabled:/etc/nginx/conf.d:ro
# I dont use volumes_from as I want to use the ro modifier
- ./static:/home/web/static:ro
- ./static:/home/web/media:ro
- ./logs:/var/log/nginx
links:
- web:uwsgi
ports:
- "62201:8080"
restart: unless-stopped
nginx:
# Note you cannot scale if you use container_name
container_name: qgis-plugins-nginx
image: nginx
hostname: nginx
volumes:
- ./sites-enabled:/etc/nginx/conf.d:ro
# I dont use volumes_from as I want to use the ro modifier
- ./static:/home/web/static:ro
- ./static:/home/web/media:ro
- ./logs:/var/log/nginx
links:
- web:uwsgi
ports:
- "62201:8080"
restart: unless-stopped
2 changes: 1 addition & 1 deletion dockerize/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ RUN echo "deb http://archive.debian.org/debian stretch main contrib non-free" >
RUN apt-get update && apt-get install -y libsasl2-dev python-dev libldap2-dev libssl-dev
ADD REQUIREMENTS.txt /REQUIREMENTS.txt
RUN pip install -r /REQUIREMENTS.txt
RUN pip install uwsgi
RUN pip install uwsgi freezegun==1.3.1

# https://docs.docker.com/examples/running_ssh_service/
# Sudo is needed by pycharm when it tries to pip install packages
Expand Down
9 changes: 6 additions & 3 deletions dockerize/docker/REQUIREMENTS.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
django==2.2.25
django-auth-ldap
python-ldap
django-taggit
django-taggit==2.0.0
django-tinymce==3.4.0
psycopg2
# Updates for Django 2
Expand All @@ -21,8 +21,11 @@ django-sortable-listview
sorl-thumbnail
django-extensions
django-debug-toolbar==1.11.1
whoosh
django-haystack

# Updates for Django 2 & Python 3.7
git+https://github.com/Xpirix/whoosh.git@a306553
pickle5==0.0.12
django-haystack==3.2.1

# Feedjack==0.9.18
# So use George's fork rather
Expand Down
9 changes: 6 additions & 3 deletions qgis-app/REQUIREMENTS_plugins.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
django==2.2.25
django-auth-ldap
python-ldap
django-taggit
django-taggit==2.0.0
django-tinymce==3.4.0
psycopg2
# Updates for Django 2
Expand All @@ -21,5 +21,8 @@ django-sortable-listview
sorl-thumbnail
django-extensions
django-debug-toolbar==1.11.1
whoosh
django-haystack

# Updates for Django 2 & Python 3.7
git+https://github.com/Xpirix/whoosh.git@a306553
pickle5==0.0.12
django-haystack==3.2.1
14 changes: 14 additions & 0 deletions qgis-app/plugins/migrations/0004_merge_20231122_0223.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Generated by Django 2.2.25 on 2023-11-30 05:13

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('plugins', '0002_plugins_feedback'),
('plugins', '0003_plugin_allow_update_name'),
]

operations = [
]
2 changes: 1 addition & 1 deletion qgis-app/plugins/tests/test_plugin_list.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.test import TestCase
from django.urls import reverse
from ..models import Plugin
from plugins.models import Plugin

class PluginsListViewTestCase(TestCase):
fixtures = [
Expand Down
4 changes: 2 additions & 2 deletions qgis-app/plugins/tests/test_plugin_version_feedback.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,11 +244,11 @@ def test_only_staff_can_see_new_feedback_form(self):
self.client.force_login(user=self.creator)
response = self.client.get(self.url)
self.assertEqual(response.status_code, 200)
self.assertNotContains(response, '<div class="span8 new-feedback">')
self.assertNotContains(response, '<div class="new-feedback">')
self.client.force_login(user=self.staff)
response = self.client.get(self.url)
self.assertEqual(response.status_code, 200)
self.assertContains(response, '<div class="span8 new-feedback">')
self.assertContains(response, '<div class="new-feedback">')

def test_post_create_single_task_feedback(self):
self.client.force_login(self.staff)
Expand Down

0 comments on commit 6589e3c

Please sign in to comment.