steveniemitz commented on a change in pull request #16229:
URL: https://github.com/apache/beam/pull/16229#discussion_r776512856



##########
File path: sdks/python/apache_beam/runners/dataflow/internal/apiclient_test.py
##########
@@ -1385,6 +1388,246 @@ def test_enable_hot_key_logging(self):
     self.assertEqual(
         env.proto.debugOptions, 
dataflow.DebugOptions(enableHotKeyLogging=True))
 
+  def _mock_uncached_copy(self, staging_root, src, sha256, dst_name=None):
+    sha_prefix = sha256[0:2]
+    gcs_cache_path = FileSystems.join(
+        staging_root,
+        apiclient.DataflowApplicationClient._GCS_CACHE_PREFIX,
+        sha_prefix,
+        sha256)
+
+    if not dst_name:
+      _, dst_name = os.path.split(src)
+    return [
+        mock.call.gcs_exists(gcs_cache_path),
+        mock.call.gcs_upload(src, gcs_cache_path),
+        mock.call.gcs_gcs_copy(
+            gcs_cache_path, f'gs://test-location/staging/{dst_name}')
+    ]
+
+  def _mock_cached_copy(self, staging_root, src, sha256, dst_name=None):
+    uncached = self._mock_uncached_copy(staging_root, src, sha256, dst_name)
+    uncached.pop(1)

Review comment:
       the difference between a cached and uncached copy (from a mocked call 
POV) is simply that the cached copy doesn't do an upload to GCS to the 
`gcs_cache_path`, this simply uses the expected calls generated by 
`_mock_uncached_copy` and removes the "upload" call.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to