Skip to content

Commit

Permalink
Fix tests to deal with concurrent uploads.
Browse files Browse the repository at this point in the history
For now, we'll also sort the mfn -- I might regret that, though.
  • Loading branch information
sz3 committed Jun 26, 2020
1 parent f5ffa1e commit 316141a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions pog/pog.py
Expand Up @@ -294,6 +294,7 @@ def encrypt(self, *inputs):
args = [(filename, count, len(all_inputs)) for count, filename in enumerate(all_inputs)]
mfn = exe.map(self.encrypt_and_store_file, args)
mfn = dict(ChainMap(*mfn)) # smash the maps together
mfn = dict(sorted(mfn.items()))

mfn_filename = self.save_manifest(mfn)
_print_progress(len(all_inputs)+1, len(all_inputs)+1, mfn_filename)
Expand Down
10 changes: 6 additions & 4 deletions tests/test_pog.py
Expand Up @@ -15,6 +15,8 @@
069:15:24 Anders (onboard): It looks like a big - looks like a big beach down there.
'''

CONCURRENCY_FLAG = '--concurrency=1'


def compute_checksum(filename):
hash_md5 = hashlib.md5()
Expand Down Expand Up @@ -51,7 +53,7 @@ class KeyfileTest(TestDirMixin, TestCase):

def test_round_trip(self):
# encrypt our sample files
enc = self.run_command(self.encryption_flag, self.tiny_sample, self.another_sample)
enc = self.run_command(self.encryption_flag, self.tiny_sample, self.another_sample, CONCURRENCY_FLAG)
manifest_name = glob(path.join(self.working_dir.name, '*.mfn'))[0]

# ordered lexicographically by filename
Expand Down Expand Up @@ -167,7 +169,7 @@ def test_consistency_fs_input(self):
def test_absolute_paths(self):
# encrypt our sample files, saving their absolute paths in the manifest
enc = self.run_command(
self.encryption_flag, self.tiny_sample, self.another_sample, '--store-absolute-paths'
self.encryption_flag, self.tiny_sample, self.another_sample, '--store-absolute-paths', CONCURRENCY_FLAG
)
manifest_name = glob(path.join(self.working_dir.name, '*.mfn'))[0]

Expand Down Expand Up @@ -213,7 +215,7 @@ def test_absolute_paths(self):
def test_glob_input_directory(self):
# encrypt our sample files, saving their absolute paths in the manifest
enc = self.run_command(
self.encryption_flag, self.input_dir.name, '--store-absolute-paths'
self.encryption_flag, self.input_dir.name, '--store-absolute-paths', CONCURRENCY_FLAG
)
manifest_name = glob(path.join(self.working_dir.name, '*.mfn'))[0]

Expand Down Expand Up @@ -250,7 +252,7 @@ def test_manifest_index_ordering(self):
We sort the blobs stored in the manifest index, to limit information about which blobs belong together.
'''
# encrypt our sample files
enc = self.run_command(self.encryption_flag, self.tiny_sample, self.another_sample)
enc = self.run_command(self.encryption_flag, self.tiny_sample, self.another_sample, CONCURRENCY_FLAG)
manifest_name = glob(path.join(self.working_dir.name, '*.mfn'))[0]

self.assertEqual(enc, [
Expand Down

0 comments on commit 316141a

Please sign in to comment.