Hello community,

here is the log from the commit of package openSUSE-release-tools for 
openSUSE:Factory checked in at 2018-01-06 18:50:39
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/openSUSE-release-tools (Old)
 and      /work/SRC/openSUSE:Factory/.openSUSE-release-tools.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "openSUSE-release-tools"

Sat Jan  6 18:50:39 2018 rev:38 rq:561803 version:20180105.7eaed34

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/openSUSE-release-tools/openSUSE-release-tools.changes
    2018-01-05 01:05:52.219157657 +0100
+++ 
/work/SRC/openSUSE:Factory/.openSUSE-release-tools.new/openSUSE-release-tools.changes
       2018-01-06 18:50:58.670217330 +0100
@@ -1,0 +2,35 @@
+Fri Jan 05 08:51:49 UTC 2018 - [email protected]
+
+- Update to version 20180105.7eaed34:
+  * Revert "osclib/conf: allow devel projects to utilize tools that require 
conf."
+
+-------------------------------------------------------------------
+Thu Jan 04 14:06:41 UTC 2018 - [email protected]
+
+- Update to version 20180104.43dea82:
+  * tests/ReviewBot_tests: add test_dryrun().
+  * tests/ReviewBot_tests: add test_only_replace_none().
+  * tests/ReviewBot_tests: add test_workflow() complex test.
+  * tests/ReviewBot_tests: add test_basic_logger() as initial test.
+
+-------------------------------------------------------------------
+Thu Jan 04 13:59:06 UTC 2018 - [email protected]
+
+- Update to version 20180104.656cba4:
+  * tests/comment_test: add test_delete_nested().
+  * tests/comment_test: add test_delete_batch().
+  * tests/comment_test: add test_basic() against OBSLocal.
+  * tests/comment_test: move COMMENT* constants to file level.
+  * tests/OBSLocal: re-parse config and reset authentication when changing 
user.
+  * tests/OBSLocal: setup test separate cookiejar.
+  * tests/comment_tests: add test_comment_find().
+  * tests/comment_tests: add test_remove_marker().
+  * tests/comment_tests: add test_add_marker().
+
+-------------------------------------------------------------------
+Thu Jan 04 11:42:05 UTC 2018 - [email protected]
+
+- Update to version 20180104.b0cd970:
+  * osclib/conf: allow devel projects to utilize tools that require conf.
+
+-------------------------------------------------------------------

Old:
----
  openSUSE-release-tools-20180104.e1b5d75.obscpio

New:
----
  openSUSE-release-tools-20180105.7eaed34.obscpio

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ openSUSE-release-tools.spec ++++++
--- /var/tmp/diff_new_pack.rVVBZG/_old  2018-01-06 18:50:59.506178270 +0100
+++ /var/tmp/diff_new_pack.rVVBZG/_new  2018-01-06 18:50:59.506178270 +0100
@@ -20,7 +20,7 @@
 %define source_dir osc-plugin-factory
 %define announcer_filename factory-package-news
 Name:           openSUSE-release-tools
-Version:        20180104.e1b5d75
+Version:        20180105.7eaed34
 Release:        0
 Summary:        Tools to aid in staging and release work for openSUSE/SUSE
 License:        GPL-2.0+ and MIT

++++++ _servicedata ++++++
--- /var/tmp/diff_new_pack.rVVBZG/_old  2018-01-06 18:50:59.566175467 +0100
+++ /var/tmp/diff_new_pack.rVVBZG/_new  2018-01-06 18:50:59.566175467 +0100
@@ -1,6 +1,6 @@
 <servicedata>
   <service name="tar_scm">
     <param 
name="url">https://github.com/openSUSE/osc-plugin-factory.git</param>
-    <param 
name="changesrevision">e1b5d75d3dc4ed26bde13eaa2b4090a8051a7af8</param>
+    <param 
name="changesrevision">7eaed349b38ed3e482f543abb717390b5d6b9afe</param>
   </service>
 </servicedata>

++++++ openSUSE-release-tools-20180104.e1b5d75.obscpio -> 
openSUSE-release-tools-20180105.7eaed34.obscpio ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/openSUSE-release-tools-20180104.e1b5d75/tests/OBSLocal.py 
new/openSUSE-release-tools-20180105.7eaed34/tests/OBSLocal.py
--- old/openSUSE-release-tools-20180104.e1b5d75/tests/OBSLocal.py       
2018-01-04 10:36:38.000000000 +0100
+++ new/openSUSE-release-tools-20180105.7eaed34/tests/OBSLocal.py       
2018-01-05 09:42:32.000000000 +0100
@@ -8,6 +8,7 @@
 import unittest
 
 OSCRC = os.path.expanduser('~/.oscrc-test')
+OSCCOOKIEJAR = os.path.expanduser('~/.osc_cookiejar-test')
 APIURL = 'local-test'
 
 class OBSLocalTestCase(unittest.TestCase):
@@ -23,10 +24,11 @@
         httpretty.disable()
 
     def setUp(self):
-        self.oscrc('Admin')
-        conf.get_config(override_conffile=OSCRC,
-                        override_no_keyring=True,
-                        override_no_gnome_keyring=True)
+        if os.path.exists(OSCCOOKIEJAR):
+            # Avoid stale cookiejar since local OBS may be completely reset.
+            os.remove(OSCCOOKIEJAR)
+
+        self.osc_user('Admin')
         self.apiurl = conf.config['apiurl']
         self.assertOBS()
 
@@ -41,6 +43,7 @@
             f.write('\n'.join([
                 '[general]',
                 'apiurl = http://0.0.0.0:3000',
+                'cookiejar = {}'.format(OSCCOOKIEJAR),
                 '[http://0.0.0.0:3000]',
                 'user = {}'.format(userid),
                 'pass = opensuse',
@@ -50,9 +53,24 @@
             ]))
 
     def osc_user(self, userid):
-        conf.config['api_host_options'][self.apiurl]['user'] = userid
         self.oscrc(userid)
 
+        # Rather than modify userid and email, just re-parse entire config and
+        # reset authentication by clearing opener to avoid edge-cases.
+        self.oscParse()
+
+    def oscParse(self):
+        # Otherwise, will stick to first user for a given apiurl.
+        conf._build_opener.last_opener = (None, None)
+
+        # Otherwise, will not re-parse same config file.
+        if 'cp' in conf.get_configParser.__dict__:
+            del conf.get_configParser.cp
+
+        conf.get_config(override_conffile=OSCRC,
+                        override_no_keyring=True,
+                        override_no_gnome_keyring=True)
+
     def execute_script(self, args):
         if self.script:
             args.insert(0, self.script)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/openSUSE-release-tools-20180104.e1b5d75/tests/ReviewBot_tests.py 
new/openSUSE-release-tools-20180105.7eaed34/tests/ReviewBot_tests.py
--- old/openSUSE-release-tools-20180104.e1b5d75/tests/ReviewBot_tests.py        
1970-01-01 01:00:00.000000000 +0100
+++ new/openSUSE-release-tools-20180105.7eaed34/tests/ReviewBot_tests.py        
2018-01-05 09:42:32.000000000 +0100
@@ -0,0 +1,138 @@
+import logging
+from OBSLocal import OBSLocalTestCase
+from osclib.comments import CommentAPI
+from ReviewBot import ReviewBot
+import random
+
+
+COMMENT = 'short comment'
+PROJECT = 'openSUSE:Factory:Staging'
+
+class TestReviewBotComment(OBSLocalTestCase):
+    def setUp(self):
+        super(TestReviewBotComment, self).setUp()
+        self.api = CommentAPI(self.apiurl)
+
+        # Ensure different test runs operate in unique namespace.
+        self.bot = '::'.join([type(self).__name__, str(random.getrandbits(8))])
+        self.review_bot = ReviewBot(self.apiurl, 
logger=logging.getLogger(self.bot))
+        self.review_bot.bot_name = self.bot
+
+        self.osc_user('factory-auto')
+
+    def tearDown(self):
+        self.api.delete_from(project_name=PROJECT)
+        self.assertFalse(len(self.api.get_comments(project_name=PROJECT)))
+
+    def test_basic_logger(self):
+        comment_count = len(self.api.get_comments(project_name=PROJECT))
+        self.assertFalse(self.comments_filtered(self.bot)[0])
+
+        # Initial comment.
+        self.review_bot.comment_handler_add()
+        self.review_bot.logger.info('something interesting')
+        self.review_bot.comment_write(project=PROJECT)
+        comment, _ = self.comments_filtered(self.bot)
+        self.assertTrue(comment['comment'].endswith('something interesting'))
+
+        # Second comment with extra line.
+        self.review_bot.comment_handler_add()
+        self.review_bot.logger.info('something interesting')
+        self.review_bot.logger.info('something extra')
+        self.review_bot.comment_write(project=PROJECT)
+        comment, _ = self.comments_filtered(self.bot)
+        self.assertTrue(comment['comment'].endswith('something extra'))
+
+    def test_workflow(self):
+        comment_count = len(self.api.get_comments(project_name=PROJECT))
+        self.assertFalse(self.comments_filtered(self.bot)[0])
+
+        # Initial comment.
+        info = {'state': 'seen', 'result': 'failed'}
+        info_extra = {'build': '1'}
+        info_merged = info.copy()
+        info_merged.update(info_extra)
+        self.review_bot.comment_write(state='seen', result='failed', 
identical=True,
+                                      info_extra=info_extra, 
info_extra_identical=False,
+                                      project=PROJECT, message=COMMENT)
+        comment, info_parsed = self.comments_filtered(self.bot)
+        self.assertTrue(comment['comment'].endswith(COMMENT))
+        self.assertEqual(info_parsed, info_merged)
+
+        # Only build change (expect no change).
+        info_extra = {'build': '2'}
+        self.review_bot.comment_write(state='seen', result='failed', 
identical=True,
+                                      info_extra=info_extra, 
info_extra_identical=False,
+                                      project=PROJECT, message=COMMENT)
+        comment, info_parsed = self.comments_filtered(self.bot)
+        self.assertTrue(comment['comment'].endswith(COMMENT))
+        self.assertEqual(info_parsed, info_merged)
+
+        # Build and comment (except comment replacement).
+        info_extra = {'build': '3'}
+        info_merged.update(info_extra)
+        self.review_bot.comment_write(state='seen', result='failed', 
identical=True,
+                                      info_extra=info_extra, 
info_extra_identical=False,
+                                      project=PROJECT, message=COMMENT + '3')
+        comment, info_parsed = self.comments_filtered(self.bot)
+        self.assertTrue(comment['comment'].endswith(COMMENT + '3'))
+        self.assertEqual(info_parsed, info_merged)
+
+        # Final build (except comment replacement).
+        info_extra = {'build': '4'}
+        info_merged.update(info_extra)
+        self.review_bot.comment_write(state='seen', result='failed', 
identical=True,
+                                      info_extra=info_extra, 
info_extra_identical=True,
+                                      project=PROJECT, message=COMMENT + '4')
+        comment, info_parsed = self.comments_filtered(self.bot)
+        self.assertTrue(comment['comment'].endswith(COMMENT + '4'))
+        self.assertEqual(info_parsed, info_merged)
+
+        # Final build (except comment replacement).
+        info = {'state': 'done', 'result': 'passed'}
+        info_extra = {'build': '5'}
+        info_merged = info.copy()
+        info_merged.update(info_extra)
+        self.review_bot.comment_write(state='done', result='passed', 
identical=True,
+                                      info_extra=info_extra, 
info_extra_identical=True,
+                                      only_replace=True,
+                                      project=PROJECT, message=COMMENT + '5')
+        comment, info_parsed = self.comments_filtered(self.bot)
+        self.assertTrue(comment['comment'].endswith(COMMENT + '5'))
+        self.assertEqual(info_parsed, info_merged)
+
+        # Should never be more than one new comment.
+        self.assertEqual(len(self.api.get_comments(project_name=PROJECT)), 
comment_count + 1)
+
+    def test_only_replace_none(self):
+        self.review_bot.comment_write(only_replace=True,
+                                      project=PROJECT, message=COMMENT)
+        self.assertFalse(self.comments_filtered(self.bot)[0])
+
+    def test_dryrun(self):
+        # dryrun = True, no comment.
+        self.review_bot.dryrun = True
+        self.review_bot.comment_write(project=PROJECT, message=COMMENT)
+        self.assertFalse(self.comments_filtered(self.bot)[0])
+
+        # dryrun = False, a comment.
+        self.review_bot.dryrun = False
+        self.review_bot.comment_write(project=PROJECT, message=COMMENT)
+        self.assertTrue(self.comments_filtered(self.bot)[0])
+
+        # dryrun = True, no replacement.
+        self.review_bot.dryrun = True
+        self.review_bot.comment_write(state='changed', project=PROJECT, 
message=COMMENT)
+        _, info = self.comments_filtered(self.bot)
+        self.assertEqual(info['state'], 'done')
+
+        # dryrun = False, replacement.
+        self.review_bot.dryrun = False
+        self.review_bot.comment_write(state='changed', project=PROJECT, 
message=COMMENT)
+        _, info = self.comments_filtered(self.bot)
+        self.assertEqual(info['state'], 'changed')
+
+    def comments_filtered(self, bot):
+        comments = self.api.get_comments(project_name=PROJECT)
+        return self.api.comment_find(comments, bot)
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/openSUSE-release-tools-20180104.e1b5d75/tests/comment_tests.py 
new/openSUSE-release-tools-20180105.7eaed34/tests/comment_tests.py
--- old/openSUSE-release-tools-20180104.e1b5d75/tests/comment_tests.py  
2018-01-04 10:36:38.000000000 +0100
+++ new/openSUSE-release-tools-20180105.7eaed34/tests/comment_tests.py  
2018-01-05 09:42:32.000000000 +0100
@@ -1,11 +1,22 @@
+from OBSLocal import OBSLocalTestCase
 from osclib.comments import CommentAPI
+import random
 import re
 import unittest
 
 
+COMMENT = 'short comment'
+COMMENT_INFO = {'foo': 'bar', 'distro': 'openSUSE'}
+PROJECT = 'openSUSE:Factory:Staging'
+
 class TestComment(unittest.TestCase):
     def setUp(self):
         self.api = CommentAPI('bogus')
+        self.bot = type(self).__name__
+        self.comments = {
+            1: {'comment': '<!-- {} -->\n\nshort comment'.format(self.bot)},
+            2: {'comment': '<!-- {} foo=bar distro=openSUSE -->\n\nshort 
comment'.format(self.bot)}
+        }
 
     def test_truncate(self):
         comment = "string of text"
@@ -46,3 +57,109 @@
             tag_count = truncated.count('<pre>') + truncated.count('</pre>')
             self.assertEqual(tag_count, truncated.count('<'))
             self.assertEqual(tag_count, truncated.count('>'))
+
+    def test_add_marker(self):
+        comment_marked = self.api.add_marker(COMMENT, self.bot)
+        self.assertEqual(comment_marked, self.comments[1]['comment'])
+
+        comment_marked = self.api.add_marker(COMMENT, self.bot, COMMENT_INFO)
+        self.assertEqual(comment_marked, self.comments[2]['comment'])
+
+    def test_remove_marker(self):
+        comment = self.api.remove_marker(COMMENT)
+        self.assertEqual(comment, COMMENT)
+
+        comment = self.api.remove_marker(self.comments[1]['comment'])
+        self.assertEqual(comment, COMMENT)
+
+        comment = self.api.remove_marker(self.comments[2]['comment'])
+        self.assertEqual(comment, COMMENT)
+
+    def test_comment_find(self):
+        comment, info = self.api.comment_find(self.comments, self.bot)
+        self.assertEqual(comment, self.comments[1])
+
+        comment, info = self.api.comment_find(self.comments, self.bot, 
COMMENT_INFO)
+        self.assertEqual(comment, self.comments[2])
+        self.assertEqual(info, COMMENT_INFO)
+
+        info_partial = dict(COMMENT_INFO)
+        del info_partial['foo']
+        comment, info = self.api.comment_find(self.comments, self.bot, 
info_partial)
+        self.assertEqual(comment, self.comments[2])
+        self.assertEqual(info, COMMENT_INFO)
+
+
+class TestCommentOBS(OBSLocalTestCase):
+    def setUp(self):
+        super(TestCommentOBS, self).setUp()
+        self.api = CommentAPI(self.apiurl)
+        # Ensure different test runs operate in unique namespace.
+        self.bot = '::'.join([type(self).__name__, str(random.getrandbits(8))])
+
+    def test_basic(self):
+        self.osc_user('staging-bot')
+
+        self.assertFalse(self.comments_filtered(self.bot)[0])
+
+        self.assertTrue(self.api.add_comment(
+            project_name=PROJECT, comment=self.api.add_marker(COMMENT, 
self.bot)))
+        comment, _ = self.comments_filtered(self.bot)
+        self.assertTrue(comment)
+
+        self.assertTrue(self.api.delete(comment['id']))
+        self.assertFalse(self.comments_filtered(self.bot)[0])
+
+    def test_delete_nested(self):
+        self.osc_user('staging-bot')
+        comment_marked = self.api.add_marker(COMMENT, self.bot)
+
+        # Allow for existing comments by basing assertion on delta from 
initial count.
+        comment_count = len(self.api.get_comments(project_name=PROJECT))
+        self.assertFalse(self.comments_filtered(self.bot)[0])
+
+        self.assertTrue(self.api.add_comment(project_name=PROJECT, 
comment=comment_marked))
+        comment, _ = self.comments_filtered(self.bot)
+        self.assertTrue(comment)
+
+        for i in range(0, 3):
+            self.assertTrue(self.api.add_comment(
+                project_name=PROJECT, comment=comment_marked, 
parent_id=comment['id']))
+
+        comments = self.api.get_comments(project_name=PROJECT)
+        parented_count = 0
+        for comment in comments.values():
+            if comment['parent']:
+                parented_count += 1
+
+        self.assertEqual(parented_count, 3)
+        self.assertTrue(len(comments) == comment_count + 4)
+
+        self.api.delete_from(project_name=PROJECT)
+        self.assertFalse(len(self.api.get_comments(project_name=PROJECT)))
+
+    def test_delete_batch(self):
+        users = ['factory-auto', 'repo-checker', 'staging-bot']
+        for user in users:
+            self.osc_user(user)
+            from osc import conf
+            bot = '::'.join([self.bot, user])
+            comment = self.api.add_marker(COMMENT, bot)
+
+            self.assertFalse(self.comments_filtered(bot)[0])
+            self.assertTrue(self.api.add_comment(project_name=PROJECT, 
comment=comment))
+            self.assertTrue(self.comments_filtered(bot)[0])
+
+        # Allow for existing comments by basing assertion on delta from 
initial count.
+        comment_count = len(self.api.get_comments(project_name=PROJECT))
+        self.assertTrue(comment_count >= len(users))
+
+        self.api.delete_from_where_user(users[0], project_name=PROJECT)
+        self.assertTrue(len(self.api.get_comments(project_name=PROJECT)) == 
comment_count - 1)
+
+        self.api.delete_from(project_name=PROJECT)
+        self.assertFalse(len(self.api.get_comments(project_name=PROJECT)))
+
+    def comments_filtered(self, bot):
+        comments = self.api.get_comments(project_name=PROJECT)
+        return self.api.comment_find(comments, bot)

++++++ openSUSE-release-tools.obsinfo ++++++
--- /var/tmp/diff_new_pack.rVVBZG/_old  2018-01-06 18:51:00.394136780 +0100
+++ /var/tmp/diff_new_pack.rVVBZG/_new  2018-01-06 18:51:00.394136780 +0100
@@ -1,5 +1,5 @@
 name: openSUSE-release-tools
-version: 20180104.e1b5d75
-mtime: 1515058598
-commit: e1b5d75d3dc4ed26bde13eaa2b4090a8051a7af8
+version: 20180105.7eaed34
+mtime: 1515141752
+commit: 7eaed349b38ed3e482f543abb717390b5d6b9afe
 


Reply via email to