mirror of https://github.com/sipwise/repoapi.git
* purge trunk release Change-Id: I783e45de40d6c6aa69db41c00ed8115a8eacecacchanges/40/14340/4
parent
5045755776
commit
7c335c3b42
@ -0,0 +1,17 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Celery Beat Service
|
||||||
|
After=network.target rabbitmq-server.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
User=www-data
|
||||||
|
Group=www-data
|
||||||
|
Environment=DJANGO_SETTINGS_MODULE=repoapi.settings.prod
|
||||||
|
PIDFile=/var/lib/repoapi/celery-beat.pid
|
||||||
|
WorkingDirectory=/usr/share/repoapi
|
||||||
|
ExecStart=/var/lib/repoapi/venv_prod/bin/python ./manage.py celery beat \
|
||||||
|
--schedule=/var/lib/repoapi/celery-beat.schedule \
|
||||||
|
--pidfile=/var/lib/repoapi/celery-beat.pid --loglevel=INFO
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
@ -0,0 +1,32 @@
|
|||||||
|
# Copyright (C) 2017 The Sipwise Team - http://sipwise.com
|
||||||
|
|
||||||
|
# This program is free software: you can redistribute it and/or modify it
|
||||||
|
# under the terms of the GNU General Public License as published by the Free
|
||||||
|
# Software Foundation, either version 3 of the License, or (at your option)
|
||||||
|
# any later version.
|
||||||
|
|
||||||
|
# This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
|
# more details.
|
||||||
|
|
||||||
|
# You should have received a copy of the GNU General Public License along
|
||||||
|
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
from repoapi.models import JenkinsBuildInfo
|
||||||
|
from django.test import override_settings
|
||||||
|
from repoapi.test.base import BaseTest
|
||||||
|
from repoapi import tasks
|
||||||
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
|
|
||||||
|
class TasksTestCase(BaseTest):
|
||||||
|
fixtures = ['test_model_queries.json']
|
||||||
|
|
||||||
|
def test_purge(self):
|
||||||
|
jbi = JenkinsBuildInfo.objects.get(pk=1)
|
||||||
|
jbi.date = datetime.now()
|
||||||
|
jbi.save()
|
||||||
|
self.assertEquals(JenkinsBuildInfo.objects.count(), 5)
|
||||||
|
tasks.jbi_purge.delay('mr3.1-fake', 3)
|
||||||
|
self.assertEquals(JenkinsBuildInfo.objects.count(), 1)
|
||||||
Loading…
Reference in new issue