-
Notifications
You must be signed in to change notification settings - Fork 1
Adding tests to verify cloud patterns #107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,6 @@ | |
% Copyright 2025 The MathWorks, Inc. | ||
|
||
methods(Test) | ||
|
||
function createDefaultArray(testcase) | ||
% Verify that zarrcreate correctly creates a Zarr array with | ||
% all default properties | ||
|
@@ -25,7 +24,6 @@ function createDefaultArray(testcase) | |
actInfo = zarrinfo(testcase.ArrPathWrite); | ||
testcase.verifyEqual(actInfo, expInfo,... | ||
'Failed to verify creating Zarr array with default properties'); | ||
|
||
end | ||
|
||
function createIntermediateZgroups(testcase) | ||
|
@@ -64,6 +62,27 @@ function createArrayRelativePath(testcase) | |
testcase.verifyEqual(arrInfo.node_type,'array','Unexpected Zarr array node type'); | ||
end | ||
|
||
function verifySupportedCloudPatterns(testcase) | ||
% Verify that the bucket name and the array path can be | ||
% extracted successfully if a cloud path is used as an input. | ||
|
||
% This list contains path pattern currently supported by Zarr | ||
% in MATLAB. Any invalid path not matching any of these | ||
% patterns will result in an error. | ||
inpPath = {'https://mybucket.s3.us-west-2.amazonaws.com/path/to/myZarrFile', ... | ||
'https://mybucket.s3.amazonaws.com/path/to/myZarrFile', ... | ||
'https://mybucket.s3.custom-endpoint.org/path/to/myZarrFile', ... | ||
'https://s3.amazonaws.com/mybucket/path/to/myZarrFile', ... | ||
'https://s3.eu-central-1.example.edu/mybucket/path/to/myZarrFile', ... | ||
's3://mybucket/path/to/myZarrFile'}; | ||
|
||
for i = 1:length(inpPath) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Very minor and somewhat subjective, but you can use a for-each loop if you don't need the index i for anything else other than getting the current path
That way you don't have to keep doing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, but keeping it as is for now, for better readability. |
||
[bucketName, objectPath] = Zarr.extractS3BucketNameAndPath(inpPath{i}); | ||
testcase.verifyEqual(bucketName, 'mybucket', ['Bucket name extraction failed for ' inpPath{i}]); | ||
testcase.verifyEqual(objectPath, 'path/to/myZarrFile', ['Object path extraction failed for ' inpPath{i}]); | ||
end | ||
end | ||
|
||
function invalidFilePath(testcase) | ||
% Verify error when an invalid file path is used as an input to | ||
% zarrcreate function. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
curious - why cell array of char vectors instead of a more modern array of strings?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing specific.