mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-29 05:00:47 +00:00
Adding a new test for read with offset
This commit is contained in:
parent
9a00acfb72
commit
c4691affb2
@ -182,6 +182,7 @@ void DiskBlobStorage::applyNewSettings(const Poco::Util::AbstractConfiguration &
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// TODO: remove this function or make it a unit test accessing a public url
|
||||||
void blob_storage_demo()
|
void blob_storage_demo()
|
||||||
{
|
{
|
||||||
// to not repeat it for every storage function
|
// to not repeat it for every storage function
|
||||||
|
@ -46,6 +46,20 @@ void checkReadAccess(IDisk & disk)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// TODO: make it a unit test ?
|
||||||
|
void checkReadWithOffset(IDisk & disk)
|
||||||
|
{
|
||||||
|
auto file = disk.readFile(test_file, DBMS_DEFAULT_BUFFER_SIZE);
|
||||||
|
auto offset = 2;
|
||||||
|
auto test_size = test_str_size - offset;
|
||||||
|
String buf(test_size, '0');
|
||||||
|
file->seek(offset, 0);
|
||||||
|
file->readStrict(buf.data(), test_size);
|
||||||
|
if (buf != test_str + offset)
|
||||||
|
throw Exception("Failed to read file with offset", ErrorCodes::PATH_ACCESS_DENIED);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void checkRemoveAccess(IDisk & disk)
|
void checkRemoveAccess(IDisk & disk)
|
||||||
{
|
{
|
||||||
// TODO: remove these checks if the names of blobs will be changed
|
// TODO: remove these checks if the names of blobs will be changed
|
||||||
@ -115,6 +129,7 @@ void registerDiskBlobStorage(DiskFactory & factory)
|
|||||||
{
|
{
|
||||||
checkWriteAccess(*blob_storage_disk);
|
checkWriteAccess(*blob_storage_disk);
|
||||||
checkReadAccess(*blob_storage_disk);
|
checkReadAccess(*blob_storage_disk);
|
||||||
|
checkReadWithOffset(*blob_storage_disk);
|
||||||
checkRemoveAccess(*blob_storage_disk);
|
checkRemoveAccess(*blob_storage_disk);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user