[copr/copr] branch master updated: frontend: more tests for
pagure_events
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
praiskup pushed a commit to branch master
in repository copr/copr.
The following commit(s) were added to refs/heads/master by this push:
new 79baf27 frontend: more tests for pagure_events
79baf27 is described below
commit 79baf273758960241dc74398776c440dd9f0fe12
Author: Silvie Chlupova <sisi.chlupova(a)gmail.com>
AuthorDate: Fri Jan 24 14:15:41 2020 +0100
frontend: more tests for pagure_events
Relates: #803
Merges: #1234
---
frontend/coprs_frontend/config/copr_unit_test.conf | 1 +
frontend/coprs_frontend/pagure_events.py | 28 ++++-------
.../coprs_frontend/tests/test_pagure_events.py | 55 +++++++++++++++++++++-
3 files changed, 63 insertions(+), 21 deletions(-)
diff --git a/frontend/coprs_frontend/config/copr_unit_test.conf b/frontend/coprs_frontend/config/copr_unit_test.conf
index 02baa96..b311733 100644
--- a/frontend/coprs_frontend/config/copr_unit_test.conf
+++ b/frontend/coprs_frontend/config/copr_unit_test.conf
@@ -68,4 +68,5 @@ PAGURE_EVENTS = {
'io.pagure.prod.pagure.git.receive' : 'https://pagure.io/',
'io.pagure.prod.pagure.pull-request.new' : 'https://pagure.io/',
'io.pagure.prod.pagure.pull-request.comment.added' : 'https://pagure.io/',
+ 'io.pagure.prod.pagure.pull-request.updated' : 'https://pagure.io/'
}
diff --git a/frontend/coprs_frontend/pagure_events.py b/frontend/coprs_frontend/pagure_events.py
index f88a00a..41ee438 100755
--- a/frontend/coprs_frontend/pagure_events.py
+++ b/frontend/coprs_frontend/pagure_events.py
@@ -57,7 +57,7 @@ class ScmPackage(object):
self.committish = self.source_json_dict.get('committish') or ''
self.subdirectory = self.source_json_dict.get('subdirectory') or ''
- self.package = ComplexLogic.get_package_by_id_safe(db_row.package_id)
+ self.package = ComplexLogic.get_package_by_id_safe(db_row.id)
self.copr = self.package.copr
def build(self, source_dict_update, copr_dir, update_callback,
@@ -68,32 +68,20 @@ class ScmPackage(object):
else:
package = self.package
- db.session.execute('LOCK TABLE build IN EXCLUSIVE MODE')
return BuildsLogic.rebuild_package(
package, source_dict_update, copr_dir, update_callback,
scm_object_type, scm_object_id, scm_object_url, submitted_by=agent_url)
@classmethod
def get_candidates_for_rebuild(cls, clone_url):
- if db.engine.url.drivername == 'sqlite':
- placeholder = '?'
- true = '1'
- else:
- placeholder = '%s'
- true = 'true'
-
- rows = db.engine.execute(
- """
- SELECT package.id AS package_id, package.source_json AS source_json, package.copr_id AS copr_id
- FROM package JOIN copr_dir ON package.copr_dir_id = copr_dir.id
- WHERE package.source_type = {0} AND
- package.webhook_rebuild = {1} AND
- copr_dir.main = {2} AND
- package.source_json ILIKE {placeholder}
- """.format(SCM_SOURCE_TYPE, true, true, placeholder=placeholder), '%'+clone_url+'%'
- )
- return [ScmPackage(row) for row in rows]
+ rows = models.Package.query \
+ .join(models.CoprDir, models.CoprDir.id == models.Package.copr_dir_id) \
+ .filter(models.Package.source_type == SCM_SOURCE_TYPE) \
+ .filter(models.Package.webhook_rebuild) \
+ .filter(models.CoprDir.main) \
+ .filter(models.Package.source_json.ilike('%' + clone_url + '%'))
+ return [ScmPackage(row) for row in rows]
def is_dir_in_commit(self, changed_files):
if not changed_files:
diff --git a/frontend/coprs_frontend/tests/test_pagure_events.py b/frontend/coprs_frontend/tests/test_pagure_events.py
index fd7f4a5..aa47043 100644
--- a/frontend/coprs_frontend/tests/test_pagure_events.py
+++ b/frontend/coprs_frontend/tests/test_pagure_events.py
@@ -1,5 +1,14 @@
-from pagure_events import event_info_from_pr_comment, event_info_from_push, event_info_from_pr
+from pagure_events import (event_info_from_pr_comment, event_info_from_push, event_info_from_pr, ScmPackage,
+ build_on_fedmsg_loop)
from tests.coprs_test_case import CoprsTestCase
+import pytest
+from unittest import mock
+
+
+class Message:
+ def __init__(self, topic, body):
+ self.topic = topic
+ self.body = body
class TestPagureEvents(CoprsTestCase):
@@ -31,6 +40,28 @@ class TestPagureEvents(CoprsTestCase):
event_info = event_info_from_pr_comment(self.data, self.base_url)
assert not event_info
+ @mock.patch('pagure_events.helpers.raw_commit_changes')
+ @mock.patch('pagure_events.get_repeatedly')
+ def test_positive_build_from_pr_update(self, f_get_repeatedly, f_raw_commit_changes, f_users, f_coprs):
+ f_raw_commit_changes.return_value = {
+ 'tests/integration/conftest.py @@ -28,6 +28,16 @@ def test_env(): return env',
+ 'tests/integration/conftest.py b/tests/integration/conftest.py index '
+ '1747874..a2b81f6 100644 --- a/tests/integration/conftest.py +++'}
+ self.p1 = self.models.Package(
+ copr=self.c1, copr_dir=self.c1_dir, name="hello-world", source_type=8, webhook_rebuild=True,
+ source_json='{"clone_url": "https://pagure.io/test/copr/copr"}'
+ )
+ build = build_on_fedmsg_loop()
+ message = Message(
+ 'io.pagure.prod.pagure.pull-request.updated',
+ self.data['msg']
+ )
+ build(message)
+ builds = self.models.Build.query.all()
+
+ assert len(builds) == 1
+ assert builds[0].scm_object_type == 'pull-request'
+
def test_positive_event_info_from_pr_comment(self):
self.data['msg']['pullrequest']["comments"].append({"comment": "[copr-build]"})
event_info = event_info_from_pr_comment(self.data, self.base_url)
@@ -50,3 +81,25 @@ class TestPagureEvents(CoprsTestCase):
self.data['msg']['repo'] = {"fullname": "test", "url_path": "test"}
event_info = event_info_from_push(self.data, self.base_url)
assert event_info.base_clone_url == "https://pagure.io/test"
+
+ @mock.patch('pagure_events.helpers.raw_commit_changes')
+ @mock.patch('pagure_events.get_repeatedly')
+ def test_positive_build_from_push(self, f_get_repeatedly, f_raw_commit_changes, f_users, f_coprs):
+ f_raw_commit_changes.return_value = {
+ 'tests/integration/conftest.py @@ -28,6 +28,16 @@ def test_env(): return env',
+ 'tests/integration/conftest.py b/tests/integration/conftest.py index '
+ '1747874..a2b81f6 100644 --- a/tests/integration/conftest.py +++'}
+ self.p1 = self.models.Package(
+ copr=self.c1, copr_dir=self.c1_dir, name="hello-world", source_type=8, webhook_rebuild=True,
+ source_json='{"clone_url": "https://pagure.io/test"}'
+ )
+ build = build_on_fedmsg_loop()
+ message = Message(
+ 'io.pagure.prod.pagure.git.receive',
+ self.data['msg']
+ )
+ build(message)
+ builds = self.models.Build.query.all()
+
+ assert len(builds) == 1
+ assert builds[0].scm_object_type == 'commit'
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
4 years, 2 months
[copr/copr] branch master updated (1ba7d22 -> ed37f42)
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
praiskup pushed a change to branch master
in repository copr/copr.
from 1ba7d22 frontend: delete action fix for incomplete builds
add e92bfbc backend: terminate copr-repo for wrong --delete sooner
add ed37f42 backend: disallow None in call_copr_repo add/delete args
No new revisions were added by this update.
Summary of changes:
backend/backend/helpers.py | 4 ++++
backend/run/copr-repo | 21 +++++++++++++++++++--
backend/tests/test_modifyrepo.py | 21 +++++++++++++++++++++
3 files changed, 44 insertions(+), 2 deletions(-)
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
4 years, 2 months
[copr/copr] branch master updated (2e33251 -> 1ba7d22)
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
praiskup pushed a change to branch master
in repository copr/copr.
from 2e33251 backend: optimize-out useless createrepo_c runs
add 1ba7d22 frontend: delete action fix for incomplete builds
No new revisions were added by this update.
Summary of changes:
.../coprs_frontend/coprs/logic/actions_logic.py | 11 +++-
frontend/coprs_frontend/tests/coprs_test_case.py | 2 +-
.../tests/test_logic/test_builds_logic.py | 74 ++++++++++++++++++++++
.../test_backend_ns/test_backend_general.py | 2 +-
.../test_views/test_coprs_ns/test_coprs_builds.py | 2 +-
5 files changed, 87 insertions(+), 4 deletions(-)
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
4 years, 2 months
[copr/copr] branch master updated (e94a3e3 -> 2e33251)
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
praiskup pushed a change to branch master
in repository copr/copr.
from e94a3e3 frontend: custom webhook to accept utf-8 hook data
add 2e33251 backend: optimize-out useless createrepo_c runs
No new revisions were added by this update.
Summary of changes:
backend/run/copr-repo | 46 ++++++++++++++++++++++++++++++++++++++++++----
1 file changed, 42 insertions(+), 4 deletions(-)
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
4 years, 2 months
[copr/copr] branch master updated (be56551 -> e94a3e3)
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
praiskup pushed a change to branch master
in repository copr/copr.
from be56551 python, cli, frontend: module dist-git instance choice
add e94a3e3 frontend: custom webhook to accept utf-8 hook data
No new revisions were added by this update.
Summary of changes:
frontend/coprs_frontend/coprs/views/webhooks_ns/webhooks_general.py | 2 +-
frontend/coprs_frontend/tests/test_webhooks.py | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
4 years, 3 months
[copr/copr] branch master updated (c812e55 -> be56551)
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
praiskup pushed a change to branch master
in repository copr/copr.
from c812e55 rpmbuild: add support for mock's module_enable
add be56551 python, cli, frontend: module dist-git instance choice
No new revisions were added by this update.
Summary of changes:
cli/copr_cli/main.py | 10 +++-
cli/tests/test_cli.py | 24 ++++++++
.../2561c13a3556_add_dist_git_instance_table.py | 34 +++++++++++
frontend/coprs_frontend/coprs/forms.py | 40 +++++++++++--
.../coprs_frontend/coprs/logic/dist_git_logic.py | 17 ++++++
.../coprs_frontend/coprs/logic/modules_logic.py | 10 ++--
frontend/coprs_frontend/coprs/models.py | 34 +++++++++++
.../coprs/views/apiv3_ns/apiv3_modules.py | 5 +-
frontend/coprs_frontend/tests/coprs_test_case.py | 22 ++++++++
.../tests/test_logic/test_modules_logic.py | 22 ++++++++
python/copr/test/client_v3/test_modules.py | 66 ++++++++++++++++++++++
python/copr/v3/proxies/module.py | 12 +++-
12 files changed, 279 insertions(+), 17 deletions(-)
create mode 100644 frontend/coprs_frontend/alembic/schema/versions/2561c13a3556_add_dist_git_instance_table.py
create mode 100644 frontend/coprs_frontend/coprs/logic/dist_git_logic.py
create mode 100644 python/copr/test/client_v3/test_modules.py
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
4 years, 3 months
[copr/copr] branch master updated (a87a1f9 -> c812e55)
by pagure@pagure.io
This is an automated email from the git hooks/post-receive script.
praiskup pushed a change to branch master
in repository copr/copr.
from a87a1f9 keygen: cron-job to automate prolonging gpg-keys
add 40ccaa5 rpmbuild: switch 'mock' testsuite against pytest
add d0238f6 rpmbuild: drop unused import from tests
add 4a8f0d4 rpmbuild: fix run_tests.sh to accept pytest options
add 1163cb2 rpmbuild: test child.cfg format
add f1e3888 rpmbuild: test expecte mock call options
add c812e55 rpmbuild: add support for mock's module_enable
No new revisions were added by this update.
Summary of changes:
rpmbuild/copr_rpmbuild/builders/mock.py | 26 ++++-
rpmbuild/mock.cfg.j2 | 4 +-
rpmbuild/run_tests.sh | 4 +-
rpmbuild/tests/test_mock.py | 182 ++++++++++++++++++++++++++++----
4 files changed, 190 insertions(+), 26 deletions(-)
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
4 years, 3 months