summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/test
diff options
context:
space:
mode:
authorChenhao Qu <chenhao.qu@mongodb.com>2023-02-08 08:54:27 +1100
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-02-08 00:26:35 +0000
commitce2ec21b1a833e4de2e07819ec09b3fa6881b1ef (patch)
treef93c21e4a76b444143e4de69e05ee23460076c86 /src/third_party/wiredtiger/test
parentfee4168d6808686eb4ab55671b1a7ae3652a3d29 (diff)
downloadmongo-ce2ec21b1a833e4de2e07819ec09b3fa6881b1ef.tar.gz
Import wiredtiger: 3861add9b4352d4d290241113414bce8913bcbaa from branch mongodb-master
ref: 9718a304d2..3861add9b4 for: 7.0.0-rc0 WT-10358 Implement flush() and flush_finish() in storage source class for Azure
Diffstat (limited to 'src/third_party/wiredtiger/test')
-rw-r--r--src/third_party/wiredtiger/test/suite/test_tiered19.py28
1 files changed, 23 insertions, 5 deletions
diff --git a/src/third_party/wiredtiger/test/suite/test_tiered19.py b/src/third_party/wiredtiger/test/suite/test_tiered19.py
index bec291ff1d8..8bc7bebd05b 100644
--- a/src/third_party/wiredtiger/test/suite/test_tiered19.py
+++ b/src/third_party/wiredtiger/test/suite/test_tiered19.py
@@ -42,7 +42,7 @@ class test_tiered19(wttest.WiredTigerTestCase, TieredConfigMixin):
is_local_storage = False,
auth_token = get_auth_token('azure_store'),
bucket = 'pythontest',
- bucket_prefix = "pfx_",
+ bucket_prefix = 'pfx_',
ss_name = 'azure_store')),
('gcp_store', dict(is_tiered = True,
is_local_storage = False,
@@ -74,12 +74,12 @@ class test_tiered19(wttest.WiredTigerTestCase, TieredConfigMixin):
# Test basic functionality of the storage source API, calling
# each supported method in the API at least once.
+ if self.ss_name != 'gcp_store':
+ return
+
session = self.session
ss = self.get_storage_source()
- if (self.ss_name != 'gcp_store'):
- return
-
# Since this class has multiple tests, append test name to the prefix to
# avoid namespace collision. 0th element on the stack is the current function.
prefix = self.bucket_prefix.join(random.choices(string.ascii_letters + string.digits, k=10))
@@ -120,7 +120,7 @@ class test_tiered19(wttest.WiredTigerTestCase, TieredConfigMixin):
fs.terminate(session)
ss.terminate(session)
- def test_ss_file_systems_gcp_and_azure(self):
+ def test_ss_azure_file_system(self):
if self.ss_name != "azure_store":
return
session = self.session
@@ -151,6 +151,24 @@ class test_tiered19(wttest.WiredTigerTestCase, TieredConfigMixin):
ss.ss_customize_file_system(
session, self.bucket, None, self.get_fs_config(prefix_2))
+ # We cannot use the file system to create files, it is readonly.
+ # So use python I/O to build up the file.
+ with open('foobar', 'wb') as f:
+ outbytes = ('MORE THAN ENOUGH DATA\n'*100000).encode()
+ f.write(outbytes)
+
+ # Flush valid file into Azure.
+ self.assertEqual(ss.ss_flush(session, azure_fs_1, 'foobar', 'foobar', None), 0)
+ # Check that file exists in Azure.
+ self.assertEqual(ss.ss_flush_finish(session, azure_fs_1, 'foobar', 'foobar', None), 0)
+
+ # Flush non valid file into Azure will result in an exception.
+ self.assertRaisesHavingMessage(wiredtiger.WiredTigerError,
+ lambda: ss.ss_flush(session, azure_fs_1, 'non_existing_file', 'non_existing_file', None), err_msg)
+ # Check that file does not exist in Azure.
+ self.assertRaisesHavingMessage(wiredtiger.WiredTigerError,
+ lambda: ss.ss_flush_finish(session, azure_fs_1, 'non_existing_file', 'non_existing_file', None), err_msg)
+
# Test that azure file system terminate succeeds.
self.assertEqual(azure_fs_1.terminate(session), 0)