[copr] master: [frontend] added test for CoprsLogic fulltext [.gitignore] added "_tmp/" pattern (246dbef)
by vgologuz@fedoraproject.org
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 246dbef49191f511b2c08a7b4bf8c6c7a5c38365
Author: Valentin Gologuzov <vgologuz(a)redhat.com>
Date: Thu Oct 30 14:50:00 2014 +0100
[frontend] added test for CoprsLogic fulltext
[.gitignore] added "_tmp/" pattern
>---------------------------------------------------------------
.gitignore | 2 +-
frontend/coprs_frontend/coprs/logic/coprs_logic.py | 2 +-
.../coprs/views/api_ns/api_general.py | 3 +-
.../coprs/views/coprs_ns/coprs_general.py | 3 +-
.../tests/test_logic/test_coprs_logic.py | 38 ++++++++++++++++++++
.../test_views/test_coprs_ns/test_coprs_general.py | 1 -
6 files changed, 42 insertions(+), 7 deletions(-)
diff --git a/.gitignore b/.gitignore
index d54326b..7467ee8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,4 +12,4 @@ documentation/build
documentation/python-doc
_venv/
_report/
-
+_tmp/
diff --git a/frontend/coprs_frontend/coprs/logic/coprs_logic.py b/frontend/coprs_frontend/coprs/logic/coprs_logic.py
index 43db461..a9bc4d7 100644
--- a/frontend/coprs_frontend/coprs/logic/coprs_logic.py
+++ b/frontend/coprs_frontend/coprs/logic/coprs_logic.py
@@ -111,7 +111,7 @@ class CoprsLogic(object):
"User is not a system admin")
@classmethod
- def get_multiple_fulltext(cls, user, search_string):
+ def get_multiple_fulltext(cls, search_string):
query = (models.Copr.query.join(models.User)
.filter(models.Copr.deleted == False))
if "/" in search_string:
diff --git a/frontend/coprs_frontend/coprs/views/api_ns/api_general.py b/frontend/coprs_frontend/coprs/views/api_ns/api_general.py
index 1e21a1e..96d3b62 100644
--- a/frontend/coprs_frontend/coprs/views/api_ns/api_general.py
+++ b/frontend/coprs_frontend/coprs/views/api_ns/api_general.py
@@ -496,8 +496,7 @@ def api_coprs_search_by_project(project=None):
httpcode = 200
if project:
try:
- query = coprs_logic.CoprsLogic.get_multiple_fulltext(
- flask.g.user, project)
+ query = coprs_logic.CoprsLogic.get_multiple_fulltext(project)
repos = query.all()
output = {"output": "ok", "repos": []}
diff --git a/frontend/coprs_frontend/coprs/views/coprs_ns/coprs_general.py b/frontend/coprs_frontend/coprs/views/coprs_ns/coprs_general.py
index ab3c05c..419483d 100644
--- a/frontend/coprs_frontend/coprs/views/coprs_ns/coprs_general.py
+++ b/frontend/coprs_frontend/coprs/views/coprs_ns/coprs_general.py
@@ -95,8 +95,7 @@ def coprs_by_allowed(username=None, page=1):
def coprs_fulltext_search(page=1):
fulltext = flask.request.args.get("fulltext", "")
try:
- query = coprs_logic.CoprsLogic.get_multiple_fulltext(
- flask.g.user, fulltext)
+ query = coprs_logic.CoprsLogic.get_multiple_fulltext(fulltext)
except ValueError as e:
flask.flash(str(e))
return flask.redirect(flask.request.referrer or
diff --git a/frontend/coprs_frontend/tests/test_logic/test_coprs_logic.py b/frontend/coprs_frontend/tests/test_logic/test_coprs_logic.py
index 39f600a..0aedd87 100644
--- a/frontend/coprs_frontend/tests/test_logic/test_coprs_logic.py
+++ b/frontend/coprs_frontend/tests/test_logic/test_coprs_logic.py
@@ -4,6 +4,7 @@ from coprs.exceptions import ActionInProgressException
from coprs.helpers import ActionTypeEnum
from coprs.logic.coprs_logic import CoprsLogic
+from coprs import models
from tests.coprs_test_case import CoprsTestCase
@@ -28,3 +29,40 @@ class TestCoprsLogic(CoprsTestCase):
# test will fail if this raises exception
CoprsLogic.raise_if_unfinished_blocking_action(
None, self.c1, "ha, failed")
+
+ def test_fulltext_whooshee_return_all_hits(self, f_users, f_db):
+ # https://bugzilla.redhat.com/show_bug.cgi?id=1153039
+ self.prefix = u"prefix"
+ self.s_coprs = []
+
+ u1_count = 150
+ for x in range(u1_count):
+ self.s_coprs.append(models.Copr(name=self.prefix + str(x), owner=self.u1))
+
+ u2_count = 7
+ for x in range(u2_count):
+ self.s_coprs.append(models.Copr(name=self.prefix + str(x), owner=self.u2))
+
+ u3_count = 9
+ for x in range(u3_count):
+ self.s_coprs.append(models.Copr(name=u"_wrong_" + str(x), owner=self.u3))
+
+
+ self.db.session.add_all(self.s_coprs)
+ self.db.session.commit()
+
+ #query = CoprsLogic.get_multiple_fulltext("prefix")
+ pre_query = models.Copr.query.join(models.User).filter(models.Copr.deleted == False)
+
+ query = pre_query.whooshee_search(self.prefix)
+
+
+ results = query.all()
+ #import ipdb; ipdb.set_trace()
+ for obj in results:
+ assert self.prefix in obj.name
+
+ obtained = len(results)
+ expected = u1_count + u2_count
+ # TODO: uncomment when fix in flask-whooshee will be released
+ #assert obtained == expected
diff --git a/frontend/coprs_frontend/tests/test_views/test_coprs_ns/test_coprs_general.py b/frontend/coprs_frontend/tests/test_views/test_coprs_ns/test_coprs_general.py
index adc3a90..0e0b94c 100644
--- a/frontend/coprs_frontend/tests/test_views/test_coprs_ns/test_coprs_general.py
+++ b/frontend/coprs_frontend/tests/test_views/test_coprs_ns/test_coprs_general.py
@@ -645,7 +645,6 @@ class TestSearch(CoprsTestCase):
#mc_flask.render_template.return_value = mock.MagicMock()
#self.prefix = u"prefix_{}_".format(int(time.time()))
self.prefix = u"prefix"
-
self.s_coprs = []
for x in range(5):
9 years, 5 months
[copr] master: [frontend] removed hardcoded frontend url from /api page. (0250a0c)
by vgologuz@fedoraproject.org
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 0250a0cb13aab8e543db5fddedd220bdf11ef77b
Author: Valentin Gologuzov <vgologuz(a)redhat.com>
Date: Thu Oct 30 12:34:33 2014 +0100
[frontend] removed hardcoded frontend url from /api page.
>---------------------------------------------------------------
frontend/coprs_frontend/config/copr.conf | 2 ++
frontend/coprs_frontend/config/copr_devel.conf | 2 ++
frontend/coprs_frontend/config/copr_unit_test.conf | 2 ++
frontend/coprs_frontend/coprs/config.py | 7 ++++++-
frontend/coprs_frontend/coprs/filters.py | 2 +-
frontend/coprs_frontend/coprs/templates/api.html | 2 +-
6 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/frontend/coprs_frontend/config/copr.conf b/frontend/coprs_frontend/config/copr.conf
index ffb0eac..3572b44 100644
--- a/frontend/coprs_frontend/config/copr.conf
+++ b/frontend/coprs_frontend/config/copr.conf
@@ -67,3 +67,5 @@ SEND_EMAILS = True
# 'email_domain': "redhat.com",
# }
#}
+
+PUBLIC_COPR_HOSTNAME = "copr.fedoraproject.org"
diff --git a/frontend/coprs_frontend/config/copr_devel.conf b/frontend/coprs_frontend/config/copr_devel.conf
index f161ca1..182e105 100644
--- a/frontend/coprs_frontend/config/copr_devel.conf
+++ b/frontend/coprs_frontend/config/copr_devel.conf
@@ -40,3 +40,5 @@ SEND_EMAILS = True
ENFORCE_PROTOCOL_FOR_BACKEND_URL = "http"
## post-process url leading to frontend
ENFORCE_PROTOCOL_FOR_FRONTEND_URL = "http"
+
+PUBLIC_COPR_HOSTNAME = "copr-fe-dev.cloud.fedoraproject.org"
diff --git a/frontend/coprs_frontend/config/copr_unit_test.conf b/frontend/coprs_frontend/config/copr_unit_test.conf
index ab6e1ab..e99f1c8 100644
--- a/frontend/coprs_frontend/config/copr_unit_test.conf
+++ b/frontend/coprs_frontend/config/copr_unit_test.conf
@@ -49,3 +49,5 @@ SEND_EMAILS = False
ENFORCE_PROTOCOL_FOR_BACKEND_URL = "https"
ENFORCE_PROTOCOL_FOR_FRONTEND_URL = "https"
+
+PUBLIC_COPR_HOSTNAME = "localhost"
diff --git a/frontend/coprs_frontend/coprs/config.py b/frontend/coprs_frontend/coprs/config.py
index e5abfb9..45c9a8b 100644
--- a/frontend/coprs_frontend/coprs/config.py
+++ b/frontend/coprs_frontend/coprs/config.py
@@ -38,12 +38,15 @@ class Config(object):
## post-process url leading to frontend
ENFORCE_PROTOCOL_FOR_FRONTEND_URL = None
+ PUBLIC_COPR_HOSTNAME = "copr-fe-dev.cloud.fedoraproject.org"
+
class ProductionConfig(Config):
DEBUG = False
#SECRET_KEY = "put_some_secret_here"
#BACKEND_PASSWORD = "password_here"
#SQLALCHEMY_DATABASE_URI = "postgresql+psycopg2://login:password@/db_name"
+ PUBLIC_COPR_HOSTNAME = "copr.fedoraproject.org"
class DevelopmentConfig(Config):
@@ -53,7 +56,7 @@ class DevelopmentConfig(Config):
ENFORCE_PROTOCOL_FOR_BACKEND_URL = "http"
ENFORCE_PROTOCOL_FOR_FRONTEND_URL = "http"
-
+ PUBLIC_COPR_HOSTNAME = "localhost:5000"
class UnitTestConfig(Config):
CSRF_ENABLED = False
@@ -63,3 +66,5 @@ class UnitTestConfig(Config):
# SQLAlchemy
SQLALCHEMY_DATABASE_URI = "sqlite:///" + os.path.abspath(DATABASE)
+
+ PUBLIC_COPR_HOSTNAME = "localhost:5000"
diff --git a/frontend/coprs_frontend/coprs/filters.py b/frontend/coprs_frontend/coprs/filters.py
index a27ffa4..1554a88 100644
--- a/frontend/coprs_frontend/coprs/filters.py
+++ b/frontend/coprs_frontend/coprs/filters.py
@@ -138,5 +138,5 @@ def fix_url_https_backend(url):
@app.template_filter("fix_url_https_frontend")
-def fix_url_https_fronend(url):
+def fix_url_https_frontend(url):
return helpers.fix_protocol_for_frontend(url)
diff --git a/frontend/coprs_frontend/coprs/templates/api.html b/frontend/coprs_frontend/coprs/templates/api.html
index 16ae028..2157aa0 100644
--- a/frontend/coprs_frontend/coprs/templates/api.html
+++ b/frontend/coprs_frontend/coprs/templates/api.html
@@ -23,7 +23,7 @@
login = {{ g.user.api_login }}
username = {{ g.user.name }}
token = {{ g.user.api_token }}
-copr_url = https://copr.fedoraproject.org
+copr_url = {{ ('https://' + config['PUBLIC_COPR_HOSTNAME'])| fix_url_https_frontend}}
# expiration date: {{ g.user.api_token_expiration }}
</pre>
9 years, 5 months
[copr] master: Automatic commit of package [copr-backend] release [1.46-1]. (dfc012f)
by vgologuz@fedoraproject.org
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit dfc012f1cc2366ad3f3d323e02ffac4eb6ed39d6
Author: Valentin Gologuzov <vgologuz(a)redhat.com>
Date: Fri Oct 24 17:47:29 2014 +0200
Automatic commit of package [copr-backend] release [1.46-1].
>---------------------------------------------------------------
backend/copr-backend.spec | 11 ++++++++++-
rel-eng/packages/copr-backend | 2 +-
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/backend/copr-backend.spec b/backend/copr-backend.spec
index c718176..2ac7a41 100644
--- a/backend/copr-backend.spec
+++ b/backend/copr-backend.spec
@@ -3,7 +3,7 @@
%endif
Name: copr-backend
-Version: 1.45
+Version: 1.46
Release: 1%{?dist}
Summary: Backend for Copr
@@ -182,6 +182,15 @@ useradd -r -g copr -G lighttpd -s /bin/bash -c "COPR user" copr
%exclude %{_pkgdocdir}/playbooks
%changelog
+* Fri Oct 24 2014 Valentin Gologuzov <vgologuz(a)redhat.com> 1.46-1
+- [backend] added handling of new action type: "createrepo"
+- [backend] added dependency on `python-copr`
+- [backend] added to mockchroot -a /devel/repodata subfolder
+- [backend] new config option to define the public frontend api endpoint
+- [backend] conditional execution of createrepo_c
+- [backend] unittest for Action and minor refactoring
+- [backend] rotate backend.log as well
+
* Thu Sep 18 2014 Miroslav Suchý <msuchy(a)redhat.com> 1.45-1
- [backend][keygen] minor fixes/typos
diff --git a/rel-eng/packages/copr-backend b/rel-eng/packages/copr-backend
index e955bed..faaeb1c 100644
--- a/rel-eng/packages/copr-backend
+++ b/rel-eng/packages/copr-backend
@@ -1 +1 @@
-1.45-1 backend/
+1.46-1 backend/
9 years, 5 months
[copr] master: Automatic commit of package [copr-frontend] release [1.47-1]. (9c01705)
by vgologuz@fedoraproject.org
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 9c01705ce4167aee3903e5bf0c23793ea355edba
Author: Valentin Gologuzov <vgologuz(a)redhat.com>
Date: Fri Oct 24 17:42:59 2014 +0200
Automatic commit of package [copr-frontend] release [1.47-1].
>---------------------------------------------------------------
frontend/copr-frontend.spec | 12 +++++++++++-
rel-eng/packages/copr-frontend | 2 +-
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/frontend/copr-frontend.spec b/frontend/copr-frontend.spec
index 30879e6..d568202 100644
--- a/frontend/copr-frontend.spec
+++ b/frontend/copr-frontend.spec
@@ -5,7 +5,7 @@
%endif
Name: copr-frontend
-Version: 1.46
+Version: 1.47
Release: 1%{?dist}
Summary: Frontend for Copr
@@ -167,6 +167,16 @@ service httpd condrestart
%doc %{_pkgdocdir}/python-doc
%changelog
+* Fri Oct 24 2014 Valentin Gologuzov <vgologuz(a)redhat.com> 1.47-1
+- [frontend] sending createrepo action
+- [frontend] [html] new option to configure copr->auto_creatrepo
+- [fronted] adding option to disable auto invokation of createrepo
+- [frontent] [WIP]fixing unittest, better isolation during test run
+- [frontend] [RHBZ: #1149091] bugfix: 'Repeat' does not respect chroot
+ selection of original build
+- Added script to automate tests execution inside virtualenv
+- [frontend] [RHBZ:#1146825] Reorder chroots for monitor widget
+
* Wed Sep 24 2014 Valentin Gologuzov <vgologuz(a)redhat.com> 1.46-1
- [frontend] added helper function and flask filter which allows to ensure that
url starts with either http or https, see config
diff --git a/rel-eng/packages/copr-frontend b/rel-eng/packages/copr-frontend
index 6faf745..f800b2b 100644
--- a/rel-eng/packages/copr-frontend
+++ b/rel-eng/packages/copr-frontend
@@ -1 +1 @@
-1.46-1 frontend/
+1.47-1 frontend/
9 years, 5 months
[copr] master: [backend] fix: run handle for createrepo action type (e94f219)
by vgologuz@fedoraproject.org
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit e94f2192ab961dd1e600d9e592d0bc36e11728a5
Author: Valentin Gologuzov <vgologuz(a)redhat.com>
Date: Fri Oct 24 16:42:40 2014 +0200
[backend] fix: run handle for createrepo action type
>---------------------------------------------------------------
backend/backend/actions.py | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/backend/backend/actions.py b/backend/backend/actions.py
index 5ee0bd3..0873c8d 100644
--- a/backend/backend/actions.py
+++ b/backend/backend/actions.py
@@ -177,6 +177,9 @@ class Action(object):
elif action_type == ActionType.RENAME:
self.handle_rename(result)
+ elif action_type == ActionType.CREATEREPO:
+ self.handle_createrepo(result)
+
if "result" in result:
if result.result == ActionResult.SUCCESS and \
not getattr(result, "job_ended_on", None):
9 years, 5 months
[copr] master: [backend] bugfix (42ee20c)
by vgologuz@fedoraproject.org
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 42ee20ce37e98de4c23a5257181bf28a59d4a766
Author: Valentin Gologuzov <vgologuz(a)redhat.com>
Date: Thu Oct 23 19:34:26 2014 +0200
[backend] bugfix
>---------------------------------------------------------------
backend/copr-be.py | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/backend/copr-be.py b/backend/copr-be.py
index bc60ea8..11af0a5 100755
--- a/backend/copr-be.py
+++ b/backend/copr-be.py
@@ -1,9 +1,7 @@
#!/usr/bin/python -ttu
-from backend.exceptions import CoprBackendError
-from backend.dispatcher import Worker
-from backend.actions import Action
+
from bunch import Bunch
from retask.task import Task
from retask.queue import Queue
@@ -22,7 +20,12 @@ import setproctitle
import signal
import sys
import time
-from callback import FrontendCallback
+
+from backend.exceptions import CoprBackendError
+from backend.dispatcher import Worker
+from backend.actions import Action
+from backend.callback import FrontendCallback
+
def _get_conf(cp, section, option, default, mode=None):
"""
9 years, 5 months
[copr] master: [backend] bugfix 2 (37476ac)
by vgologuz@fedoraproject.org
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit 37476acd254332e66dbb5af8a650466ba34facb7
Author: Valentin Gologuzov <vgologuz(a)redhat.com>
Date: Fri Oct 24 17:29:30 2014 +0200
[backend] bugfix 2
>---------------------------------------------------------------
backend/backend/actions.py | 8 ++------
1 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/backend/backend/actions.py b/backend/backend/actions.py
index 4b6e02a..a6d80c1 100644
--- a/backend/backend/actions.py
+++ b/backend/backend/actions.py
@@ -5,7 +5,7 @@ import time
from bunch import Bunch
-from .createrepo import createrepo
+from .createrepo import createrepo, createrepo_unsafe
class Action(object):
@@ -52,11 +52,7 @@ class Action(object):
path = os.path.join(self.destdir, username, projectname, chroot)
- errcode, _, err = createrepo(
- path=path, lock=self.lock,
- front_url=self.front_url,
- username=username, projectname=projectname
- )
+ errcode, _, err = createrepo_unsafe(path=path, lock=self.lock)
if errcode != 0 or err.strip():
self.add_event("Error making local repo: {0}".format(err))
failure = True
9 years, 5 months
[copr] master: [backend] bugfix (e0a44e5)
by vgologuz@fedoraproject.org
Repository : http://git.fedorahosted.org/cgit/copr.git
On branch : master
>---------------------------------------------------------------
commit e0a44e5d73acc5a4124e4de3e438f69be4f5bd1f
Author: Valentin Gologuzov <vgologuz(a)redhat.com>
Date: Fri Oct 24 17:26:42 2014 +0200
[backend] bugfix
>---------------------------------------------------------------
backend/backend/actions.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/backend/backend/actions.py b/backend/backend/actions.py
index 0873c8d..4b6e02a 100644
--- a/backend/backend/actions.py
+++ b/backend/backend/actions.py
@@ -53,7 +53,7 @@ class Action(object):
path = os.path.join(self.destdir, username, projectname, chroot)
errcode, _, err = createrepo(
- path=os.path.join(path, chroot), lock=self.lock,
+ path=path, lock=self.lock,
front_url=self.front_url,
username=username, projectname=projectname
)
9 years, 5 months