Deprecate max_updates from AU tests am: f56f5c6b3b am: e4d5332927 am: 42a64d383c am: 1d8d3320df

Change-Id: I35f06cb139dced458ec3f888ebf5d26a3836668c
diff --git a/client/cros/update_engine/update_engine_util.py b/client/cros/update_engine/update_engine_util.py
index 88d85f9..61a5e05 100644
--- a/client/cros/update_engine/update_engine_util.py
+++ b/client/cros/update_engine/update_engine_util.py
@@ -352,7 +352,7 @@
                                        files[1])).stdout
 
 
-    def _create_custom_lsb_release(self, update_url, build='0.0.0.0'):
+    def _create_custom_lsb_release(self, update_url, build='0.0.0.0', **kwargs):
         """
         Create a custom lsb-release file.
 
@@ -363,8 +363,15 @@
         @param update_url: String of url to use for update check.
         @param build: String of the build number to use. Represents the
                       Chrome OS build this device thinks it is on.
+        @param kwargs: A dictionary of key/values to be made into a query string
+                       and appended to the update_url
 
         """
+        # TODO(ahassani): This is quite fragile as the given URL can already
+        # have a search query. We need to unpack the URL and update the search
+        # query portion of it with kwargs.
+        update_url = (update_url + '?' + '&'.join('%s=%s' % (k, v)
+                                                  for k, v in kwargs.items()))
         self._run('mkdir %s' % os.path.dirname(self._CUSTOM_LSB_RELEASE),
                   ignore_status=True)
         self._run('touch %s' % self._CUSTOM_LSB_RELEASE)
diff --git a/server/cros/update_engine/omaha_devserver.py b/server/cros/update_engine/omaha_devserver.py
index 48c3e41..41169c3 100644
--- a/server/cros/update_engine/omaha_devserver.py
+++ b/server/cros/update_engine/omaha_devserver.py
@@ -48,20 +48,17 @@
     _DEVSERVER_TIMELIMIT_SECONDS = 12 * 60 * 60
 
 
-    def __init__(self, omaha_host, payload_location, max_updates=1,
-                 critical_update=True, moblab=False):
+    def __init__(self, omaha_host, payload_location, critical_update=True,
+                 moblab=False):
         """Starts a private devserver instance, operating at Omaha capacity.
 
         @param omaha_host: host address where the devserver is spawned.
         @param payload_location: partial path from static dir to payload.
-        @param max_updates: int number of updates this devserver will handle.
-                            This is passed to src/platform/dev/devserver.py.
         @param critical_update: Whether to set a deadline in responses.
         @param moblab: True if we are running on moblab.
 
         """
         self._critical_update = critical_update
-        self._max_updates = max_updates
         self._omaha_host = omaha_host
         self._devserver_pid = 0
         self._devserver_port = 0  # Determined later from devserver portfile.
@@ -224,7 +221,6 @@
                 '--pidfile=%s' % self._devserver_pidfile,
                 '--portfile=%s' % self._devserver_portfile,
                 '--logfile=%s' % self._devserver_logfile,
-                '--max_updates=%s' % self._max_updates,
                 '--host_log',
                 '--static_dir=%s' % self._devserver_static_dir,
                 '--payload=%s' % os.path.join(self._devserver_static_dir,
diff --git a/server/cros/update_engine/update_engine_test.py b/server/cros/update_engine/update_engine_test.py
index 8200665..23feef9 100644
--- a/server/cros/update_engine/update_engine_test.py
+++ b/server/cros/update_engine/update_engine_test.py
@@ -651,8 +651,8 @@
 
 
     def get_update_url_for_test(self, job_repo_url, full_payload=True,
-                                critical_update=False, max_updates=1,
-                                public=False, moblab=False):
+                                critical_update=False, public=False,
+                                moblab=False):
         """
         Get the correct update URL for autoupdate tests to use.
 
@@ -672,9 +672,6 @@
         @param job_repo_url: string url containing the current build.
         @param full_payload: bool whether we want a full payload.
         @param critical_update: bool whether we need a critical update.
-        @param max_updates: int number of updates the test will perform. This
-                            is passed to src/platform/dev/devserver.py if we
-                            create our own deverver.
         @param public: url needs to be publicly accessible.
         @param moblab: True if we are running on moblab.
 
@@ -726,7 +723,7 @@
         # We need to start our own devserver instance on the lab devserver
         # for the rest of the test scenarios.
         self._omaha_devserver = omaha_devserver.OmahaDevserver(
-            lab_devserver.hostname, payload_location, max_updates=max_updates,
+            lab_devserver.hostname, payload_location,
             critical_update=critical_update, moblab=moblab)
         self._omaha_devserver.start_devserver()
 
diff --git a/server/site_tests/autoupdate_ForcedOOBEUpdate/autoupdate_ForcedOOBEUpdate.py b/server/site_tests/autoupdate_ForcedOOBEUpdate/autoupdate_ForcedOOBEUpdate.py
index 43cb028..9c0013c 100644
--- a/server/site_tests/autoupdate_ForcedOOBEUpdate/autoupdate_ForcedOOBEUpdate.py
+++ b/server/site_tests/autoupdate_ForcedOOBEUpdate/autoupdate_ForcedOOBEUpdate.py
@@ -59,8 +59,7 @@
 
 
     def run_once(self, full_payload=True, cellular=False,
-                 interrupt=None, max_updates=1, job_repo_url=None,
-                 moblab=False):
+                 interrupt=None, job_repo_url=None, moblab=False):
         """
         Runs a forced autoupdate during ChromeOS OOBE.
 
@@ -68,8 +67,6 @@
         @param cellular: True to do the update over a cellualar connection.
                          Requires that the DUT have a sim card slot.
         @param interrupt: Type of interrupt to try: [reboot, network, suspend]
-        @param max_updates: Used to tell the test how many times it is
-                            expected to ping its omaha server.
         @param job_repo_url: Used for debugging locally. This is used to figure
                              out the current build and the devserver to use.
                              The test will read this from a host argument
@@ -87,7 +84,6 @@
                                                   full_payload=full_payload,
                                                   critical_update=True,
                                                   public=cellular,
-                                                  max_updates=max_updates,
                                                   moblab=moblab)
         before = self._get_chromeos_version()
         payload_info = None
@@ -125,6 +121,10 @@
                 raise error.TestFail('The update did not continue where it '
                                      'left off after interruption.')
 
+        # We create a new lsb-release file with no_update=True so there won't be
+        # any more actual updates happen.
+        self._create_custom_lsb_release(update_url, no_update=True)
+
         self._wait_for_oobe_update_to_complete()
 
         if cellular:
diff --git a/server/site_tests/autoupdate_ForcedOOBEUpdate/control.interrupt.network.full b/server/site_tests/autoupdate_ForcedOOBEUpdate/control.interrupt.network.full
index ecdac55..1b39c6e 100644
--- a/server/site_tests/autoupdate_ForcedOOBEUpdate/control.interrupt.network.full
+++ b/server/site_tests/autoupdate_ForcedOOBEUpdate/control.interrupt.network.full
@@ -27,6 +27,6 @@
 def run(machine):
     host = hosts.create_host(machine)
     job.run_test('autoupdate_ForcedOOBEUpdate', host=host, full_payload=True,
-                 interrupt='network', max_updates=1, **args_dict)
+                 interrupt='network', **args_dict)
 
 job.parallel_simple(run, machines)
diff --git a/server/site_tests/autoupdate_ForcedOOBEUpdate/control.interrupt.network.full.moblab b/server/site_tests/autoupdate_ForcedOOBEUpdate/control.interrupt.network.full.moblab
index 23219c4..708ff6a 100644
--- a/server/site_tests/autoupdate_ForcedOOBEUpdate/control.interrupt.network.full.moblab
+++ b/server/site_tests/autoupdate_ForcedOOBEUpdate/control.interrupt.network.full.moblab
@@ -27,6 +27,6 @@
 def run(machine):
     host = hosts.create_host(machine)
     job.run_test('autoupdate_ForcedOOBEUpdate', host=host, full_payload=True,
-                 interrupt='network', max_updates=1, moblab=True, **args_dict)
+                 interrupt='network', moblab=True, **args_dict)
 
 job.parallel_simple(run, machines)
diff --git a/server/site_tests/autoupdate_ForcedOOBEUpdate/control.interrupt.reboot.full b/server/site_tests/autoupdate_ForcedOOBEUpdate/control.interrupt.reboot.full
index 77eb5f5..52a56a9 100644
--- a/server/site_tests/autoupdate_ForcedOOBEUpdate/control.interrupt.reboot.full
+++ b/server/site_tests/autoupdate_ForcedOOBEUpdate/control.interrupt.reboot.full
@@ -24,6 +24,6 @@
 def run(machine):
     host = hosts.create_host(machine)
     job.run_test('autoupdate_ForcedOOBEUpdate', host=host, full_payload=True,
-                 interrupt='reboot', max_updates=2, **args_dict)
+                 interrupt='reboot', **args_dict)
 
 job.parallel_simple(run, machines)
diff --git a/server/site_tests/autoupdate_ForcedOOBEUpdate/control.interrupt.reboot.full.moblab b/server/site_tests/autoupdate_ForcedOOBEUpdate/control.interrupt.reboot.full.moblab
index 675642b..b39e37f 100644
--- a/server/site_tests/autoupdate_ForcedOOBEUpdate/control.interrupt.reboot.full.moblab
+++ b/server/site_tests/autoupdate_ForcedOOBEUpdate/control.interrupt.reboot.full.moblab
@@ -24,6 +24,6 @@
 def run(machine):
     host = hosts.create_host(machine)
     job.run_test('autoupdate_ForcedOOBEUpdate', host=host, full_payload=True,
-                 interrupt='reboot', max_updates=2, moblab=True, **args_dict)
+                 interrupt='reboot', moblab=True, **args_dict)
 
 job.parallel_simple(run, machines)
diff --git a/server/site_tests/autoupdate_ForcedOOBEUpdate/control.interrupt.suspend.full b/server/site_tests/autoupdate_ForcedOOBEUpdate/control.interrupt.suspend.full
index 4a8c750..617fbcc 100644
--- a/server/site_tests/autoupdate_ForcedOOBEUpdate/control.interrupt.suspend.full
+++ b/server/site_tests/autoupdate_ForcedOOBEUpdate/control.interrupt.suspend.full
@@ -24,6 +24,6 @@
 def run(machine):
     host = hosts.create_host(machine)
     job.run_test('autoupdate_ForcedOOBEUpdate', host=host, full_payload=True,
-                 interrupt='suspend', max_updates=1, **args_dict)
+                 interrupt='suspend', **args_dict)
 
 job.parallel_simple(run, machines)
diff --git a/server/site_tests/autoupdate_ForcedOOBEUpdate/control.interrupt.suspend.full.moblab b/server/site_tests/autoupdate_ForcedOOBEUpdate/control.interrupt.suspend.full.moblab
index 0aa9fc6..f44fe90 100644
--- a/server/site_tests/autoupdate_ForcedOOBEUpdate/control.interrupt.suspend.full.moblab
+++ b/server/site_tests/autoupdate_ForcedOOBEUpdate/control.interrupt.suspend.full.moblab
@@ -24,6 +24,6 @@
 def run(machine):
     host = hosts.create_host(machine)
     job.run_test('autoupdate_ForcedOOBEUpdate', host=host, full_payload=True,
-                 interrupt='suspend', max_updates=1, moblab=True, **args_dict)
+                 interrupt='suspend', moblab=True, **args_dict)
 
 job.parallel_simple(run, machines)
diff --git a/server/site_tests/autoupdate_Interruptions/autoupdate_Interruptions.py b/server/site_tests/autoupdate_Interruptions/autoupdate_Interruptions.py
index 83f4b1f..3b559ed 100644
--- a/server/site_tests/autoupdate_Interruptions/autoupdate_Interruptions.py
+++ b/server/site_tests/autoupdate_Interruptions/autoupdate_Interruptions.py
@@ -19,8 +19,7 @@
         super(autoupdate_Interruptions, self).cleanup()
 
 
-    def run_once(self, full_payload=True, interrupt=None, job_repo_url=None,
-                 max_updates=2):
+    def run_once(self, full_payload=True, interrupt=None, job_repo_url=None):
         """
         Runs an update with interruptions from the user.
 
@@ -30,15 +29,12 @@
                              out the current build and the devserver to use.
                              The test will read this from a host argument
                              when run in the lab.
-        @param max_updates: The number of update attempts the devserver should
-                            accept.
 
         """
 
         update_url = self.get_update_url_for_test(job_repo_url,
                                                   full_payload=full_payload,
-                                                  critical_update=True,
-                                                  max_updates=max_updates)
+                                                  critical_update=True)
         chromeos_version = self._get_chromeos_version()
 
         # Choose a random downloaded progress to interrupt the update.
@@ -82,7 +78,10 @@
         self._host.reboot()
         utils.poll_for_condition(self._get_update_engine_status,
                                  desc='update engine to start')
-        self._check_for_update(server=server, port=parsed_url.port)
+        # We do check update with no_update=True so it doesn't start the update
+        # again.
+        self._check_for_update(server=server, port=parsed_url.port,
+                               no_update=True)
 
         # Verify that the update completed successfully by checking hostlog.
         rootfs_hostlog, reboot_hostlog = self._create_hostlog_files()
diff --git a/server/site_tests/autoupdate_Interruptions/control.network.full b/server/site_tests/autoupdate_Interruptions/control.network.full
index 65bfdf0..d488310 100644
--- a/server/site_tests/autoupdate_Interruptions/control.network.full
+++ b/server/site_tests/autoupdate_Interruptions/control.network.full
@@ -23,6 +23,6 @@
 def run(machine):
     host = hosts.create_host(machine)
     job.run_test('autoupdate_Interruptions', host=host, full_payload=True,
-                 interrupt='network', max_updates=1, **args_dict)
+                 interrupt='network', **args_dict)
 
 job.parallel_simple(run, machines)
diff --git a/server/site_tests/autoupdate_Interruptions/control.reboot.full b/server/site_tests/autoupdate_Interruptions/control.reboot.full
index 50cac27..4675f34 100644
--- a/server/site_tests/autoupdate_Interruptions/control.reboot.full
+++ b/server/site_tests/autoupdate_Interruptions/control.reboot.full
@@ -23,6 +23,6 @@
 def run(machine):
     host = hosts.create_host(machine)
     job.run_test('autoupdate_Interruptions', host=host, full_payload=True,
-                 interrupt='reboot', max_updates=2, **args_dict)
+                 interrupt='reboot', **args_dict)
 
 job.parallel_simple(run, machines)
diff --git a/server/site_tests/autoupdate_Interruptions/control.suspend.full b/server/site_tests/autoupdate_Interruptions/control.suspend.full
index 45df4bb..680f9f8 100644
--- a/server/site_tests/autoupdate_Interruptions/control.suspend.full
+++ b/server/site_tests/autoupdate_Interruptions/control.suspend.full
@@ -23,6 +23,6 @@
 def run(machine):
     host = hosts.create_host(machine)
     job.run_test('autoupdate_Interruptions', host=host, full_payload=True,
-                 interrupt='suspend', max_updates=1, **args_dict)
+                 interrupt='suspend', **args_dict)
 
 job.parallel_simple(run, machines)
diff --git a/server/site_tests/autoupdate_P2P/autoupdate_P2P.py b/server/site_tests/autoupdate_P2P/autoupdate_P2P.py
index 52c1a39..ab4a118 100644
--- a/server/site_tests/autoupdate_P2P/autoupdate_P2P.py
+++ b/server/site_tests/autoupdate_P2P/autoupdate_P2P.py
@@ -310,8 +310,7 @@
         # P2P updates are very slow so we will only update with a delta payload.
         update_url = self.get_update_url_for_test(job_repo_url,
                                                   full_payload=False,
-                                                  critical_update=False,
-                                                  max_updates=2)
+                                                  critical_update=False)
 
         # The first device just updates normally.
         self._update_dut(self._hosts[0], update_url)