← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~cjwatson/launchpad/queue-api-test-cleanups into lp:launchpad

 

Colin Watson has proposed merging lp:~cjwatson/launchpad/queue-api-test-cleanups into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/queue-api-test-cleanups/+merge/113438

== Summary ==

In order to replace the queue tool with an API client, we'll need to ensure that Launchpad does not use that tool in its own test suite.

== Proposed fix ==

Test the model directly where appropriate (TestDistroSeriesQueueDistUpgrader.test_queue_tool_behaviour), and remove "queue fetch" tests which are adequately covered by tests added in https://code.launchpad.net/~cjwatson/launchpad/queue-api-readonly/+merge/113202.

== Tests ==

bin/test -vvct test_distroseriesqueue
-- 
https://code.launchpad.net/~cjwatson/launchpad/queue-api-test-cleanups/+merge/113438
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/queue-api-test-cleanups into lp:launchpad.
=== modified file 'lib/lp/soyuz/tests/test_distroseriesqueue_ddtp_tarball.py'
--- lib/lp/soyuz/tests/test_distroseriesqueue_ddtp_tarball.py	2012-05-25 13:28:31 +0000
+++ lib/lp/soyuz/tests/test_distroseriesqueue_ddtp_tarball.py	2012-07-04 17:25:24 +0000
@@ -27,10 +27,6 @@
     getPolicy,
     )
 from lp.services.log.logger import DevNullLogger
-from lp.soyuz.scripts.queue import (
-    CommandRunner,
-    name_queue_map,
-    )
 from lp.soyuz.tests.test_publishing import TestNativePublishingBase
 from lp.testing.gpgkeys import import_public_test_keys
 
@@ -68,30 +64,6 @@
     def test_accepts_correct_upload(self):
         self.uploadTestData("20060728")
 
-    def runQueueCommand(self, queue_name, args):
-        def null_display(text):
-            pass
-
-        queue = name_queue_map[queue_name]
-        runner = CommandRunner(
-            queue, "ubuntutest", "breezy-autotest", True, None, None, None,
-            display=null_display)
-        runner.execute(args)
-
-    def test_queue_tool_behaviour(self):
-        # The queue tool can fetch ddtp-tarball uploads.
-        self.uploadTestData("20060728")
-        # Make sure that we can use the librarian files.
-        transaction.commit()
-        # Fetch upload into a temporary directory.
-        self.useTempDir()
-        self.runQueueCommand("accepted", ["fetch", "trans"])
-        expected_entries = [
-            "translations-main_20060728_all.changes",
-            "translations_main_20060728.tar.gz",
-            ]
-        self.assertContentEqual(expected_entries, os.listdir("."))
-
     def test_publish(self):
         upload = self.uploadTestData("20060728")
         transaction.commit()

=== modified file 'lib/lp/soyuz/tests/test_distroseriesqueue_dist_upgrader.py'
--- lib/lp/soyuz/tests/test_distroseriesqueue_dist_upgrader.py	2012-07-03 10:29:53 +0000
+++ lib/lp/soyuz/tests/test_distroseriesqueue_dist_upgrader.py	2012-07-04 17:25:24 +0000
@@ -23,10 +23,6 @@
     )
 from lp.services.config import config
 from lp.services.log.logger import DevNullLogger
-from lp.soyuz.scripts.queue import (
-    CommandRunner,
-    name_queue_map,
-    )
 from lp.soyuz.tests.test_publishing import TestNativePublishingBase
 from lp.testing.gpgkeys import import_public_test_keys
 
@@ -69,37 +65,18 @@
     def test_accepts_correct_upload(self):
         self.uploadTestData("20060302.0120")
 
-    def runQueueCommand(self, queue_name, args):
-        def null_display(text):
-            pass
-
-        queue = name_queue_map[queue_name]
-        runner = CommandRunner(
-            queue, "ubuntutest", "breezy-autotest", True, None, None, None,
-            display=null_display)
-        runner.execute(args)
-
-    def test_queue_tool_behaviour(self):
-        # The queue tool can accept, reject, and fetch dist-upgrader
-        # uploads.  See bug #54649.
+    def test_accept_reject(self):
+        # We can accept and reject dist-upgrader uploads.
         upload = self.uploadTestData("20060302.0120")
         # Make sure that we can use the librarian files.
         transaction.commit()
         # Reject from accepted queue (unlikely, would normally be from
         # unapproved or new).
-        self.runQueueCommand("accepted", ["reject", "dist"])
+        upload.queue_root.rejectFromQueue(logger=self.logger)
         self.assertEqual("REJECTED", upload.queue_root.status.name)
         # Accept from rejected queue (also unlikely, but only for testing).
-        self.runQueueCommand("rejected", ["accept", "dist"])
+        upload.queue_root.acceptFromQueue(logger=self.logger)
         self.assertEqual("ACCEPTED", upload.queue_root.status.name)
-        # Fetch upload into a temporary directory.
-        self.useTempDir()
-        self.runQueueCommand("accepted", ["fetch", "dist"])
-        expected_entries = [
-            "dist-upgrader_20060302.0120_all.changes",
-            "dist-upgrader_20060302.0120_all.tar.gz",
-            ]
-        self.assertContentEqual(expected_entries, os.listdir("."))
 
     def test_bad_upload_remains_in_accepted(self):
         # Bad dist-upgrader uploads remain in ACCEPTED.


Follow ups