Skip to content

Commit

Permalink
Mark operations unsupported by LakeFS filesystem (#1881)
Browse files Browse the repository at this point in the history
* mark append as unsupported operation

* include intellij project settings to running test from IDE

* add the content of LakeFSFileSystem.java

* Revert "include intellij project settings to running test from IDE"

This reverts commit b47341b.
  • Loading branch information
talSofer authored May 4, 2021
1 parent d0f0fe3 commit ca96271
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 25 deletions.
4 changes: 2 additions & 2 deletions clients/hadoopfs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>3.9.0</version>
<artifactId>mockito-all</artifactId>
<version>1.10.19</version>
</dependency>
<dependency>
<groupId>junit</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@

/**
* A dummy implementation of the core Lakefs Filesystem.
* This class implements a {@link FileSystem} that can be registered to Spark and support limited write and read actions.
* This class implements a {@link LakeFSFileSystem} that can be registered to Spark and support limited write and read actions.
*/
public class FileSystem extends org.apache.hadoop.fs.FileSystem {
public class LakeFSFileSystem extends org.apache.hadoop.fs.FileSystem {

@Override
public URI getUri() {
Expand Down Expand Up @@ -48,8 +48,7 @@ public FSDataOutputStream create(Path path, FsPermission fsPermission, boolean b

@Override
public FSDataOutputStream append(Path path, int i, Progressable progressable) throws IOException {
LOG.debug("$$$$$$$$$$$$$$$$$$$$$$$$$$$$ append $$$$$$$$$$$$$$$$$$$$$$$$$$$$ ");
return null;
throw new UnsupportedOperationException("Append is not supported by LakeFSFileSystem");
}

@Override
Expand Down
19 changes: 0 additions & 19 deletions clients/hadoopfs/src/test/java/io/lakefs/FileSystemTest.java

This file was deleted.

35 changes: 35 additions & 0 deletions clients/hadoopfs/src/test/java/io/lakefs/LakeFSFileSystemTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package io.lakefs;

import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

import java.io.IOException;
import java.net.URI;

public class LakeFSFileSystemTest {

LakeFSFileSystem fs;

@Before
public void setUp() throws Exception {
fs = new LakeFSFileSystem();
}

@After
public void tearDown() throws Exception {
fs = null;
}

@Test
public void getUri() {
URI u = fs.getUri();
Assert.assertEquals(u.toString(), "lakefs://main");
}

@Test(expected = UnsupportedOperationException.class)
public void testAppend() throws IOException {
fs.append(null, 0, null);
}
}

0 comments on commit ca96271

Please sign in to comment.