Skip to content
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

Ci/test against universe #36

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 31 additions & 1 deletion .github/workflows/platform-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,34 @@ jobs:
distribution: 'zulu'
cache: 'maven'
- name: Maven Test
run: mvn -B clean test --file pom.xml
run: mvn -B clean install --file pom.xml

- name: Checkout n5-universe Repository
uses: actions/checkout@v2
with:
repository: saalfeldlab/n5-universe
path: n5-universe


- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install blosc (Windows)
if: matrix.os == 'windows-latest'
run: |
pip install blosc --no-input --target n5-universe/src/test/resources
mv n5-universe/src/test/resources/bin/* n5-universe/src/test/resources
- name: Install blosc (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
pip install blosc --no-input --target n5-universe/src/test/resources
mv n5-universe/src/test/resources/lib64/* n5-universe/src/test/resources

- name: Get version from Maven and Replace
run: |
version=$(mvn -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive exec:exec)
sed -i "s|<n5-aws-s3.version>.*</n5-aws-s3.version>|<n5-aws-s3.version>$version</n5-aws-s3.version>|g" n5-universe/pom.xml

- name: Maven Test Against N5-Universe
run: mvn "-Dtest=N5StorageTests$N5AmazonS3MockTest, ZarrStorageTests$ZarrAmazonS3MockTest" -B clean test --file n5-universe/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ private URI uriResolve(URI uri, String normalPath) throws URISyntaxException {
@Override
public boolean exists(final String normalPath) {

return isDirectory(normalPath) || isFile(normalPath);
return isFile(normalPath) || isDirectory(normalPath);
}

private ListObjectsV2Result queryPrefix(final String prefix) {
Expand Down Expand Up @@ -396,20 +396,17 @@ public String[] listDirectories(final String normalPath) {

private String[] list(final String normalPath, final boolean onlyDirectories) {

if (!isDirectory(normalPath)) {
throw new N5Exception.N5IOException(normalPath + " is not a valid group");
}

final String pathKey = AmazonS3Utils.getS3Key(normalPath);
final List<String> subGroups = new ArrayList<>();
final String prefix = removeLeadingSlash(addTrailingSlash(pathKey));
final ListObjectsV2Request listObjectsRequest = new ListObjectsV2Request()
.withBucketName(bucketName)
.withPrefix(prefix)
.withDelimiter("/");
ListObjectsV2Result objectsListing;
ListObjectsV2Result objectsListing = s3.listObjectsV2(listObjectsRequest);
if (objectsListing.getKeyCount() <= 0)
throw new N5Exception.N5IOException(normalPath + " is not a valid group");
do {
objectsListing = s3.listObjectsV2(listObjectsRequest);
for (final String commonPrefix : objectsListing.getCommonPrefixes()) {
if (!onlyDirectories || commonPrefix.endsWith("/")) {
final String relativePath = relativize(commonPrefix, prefix);
Expand All @@ -418,6 +415,8 @@ private String[] list(final String normalPath, final boolean onlyDirectories) {
}
}
listObjectsRequest.setContinuationToken(objectsListing.getNextContinuationToken());
if (objectsListing.isTruncated())
objectsListing = s3.listObjectsV2(listObjectsRequest);
} while (objectsListing.isTruncated());
return subGroups.toArray(new String[subGroups.size()]);
}
Expand Down
Loading