Skip to content

Commit 316141a

Browse files
committed
Fix tests to deal with concurrent uploads.
For now, we'll also sort the mfn -- I might regret that, though.
1 parent f5ffa1e commit 316141a

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

pog/pog.py

+1
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ def encrypt(self, *inputs):
294294
args = [(filename, count, len(all_inputs)) for count, filename in enumerate(all_inputs)]
295295
mfn = exe.map(self.encrypt_and_store_file, args)
296296
mfn = dict(ChainMap(*mfn)) # smash the maps together
297+
mfn = dict(sorted(mfn.items()))
297298

298299
mfn_filename = self.save_manifest(mfn)
299300
_print_progress(len(all_inputs)+1, len(all_inputs)+1, mfn_filename)

tests/test_pog.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
069:15:24 Anders (onboard): It looks like a big - looks like a big beach down there.
1616
'''
1717

18+
CONCURRENCY_FLAG = '--concurrency=1'
19+
1820

1921
def compute_checksum(filename):
2022
hash_md5 = hashlib.md5()
@@ -51,7 +53,7 @@ class KeyfileTest(TestDirMixin, TestCase):
5153

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

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

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

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

256258
self.assertEqual(enc, [

0 commit comments

Comments
 (0)