Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bubriks committed Dec 19, 2024
1 parent 8f031dc commit f2bbc87
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import com.logicalclocks.hsfs.FeatureStoreException;
import com.logicalclocks.hsfs.StorageConnectorType;
import com.logicalclocks.hsfs.StorageConnector.S3Connector;
import com.logicalclocks.hsfs.metadata.HopsworksClient;
import com.logicalclocks.hsfs.metadata.HopsworksHttpClient;
import com.logicalclocks.hsfs.metadata.Option;
Expand Down Expand Up @@ -245,6 +246,33 @@ void testDefaultPathS3() throws FeatureStoreException, IOException {
// reset
SparkEngine.setInstance(null);
}

@Test
void testGetPath() throws FeatureStoreException, IOException {
// Arrange
S3Connector connector = new S3Connector();
connector.setBucket("testBucket");

// Act
String path = connector.getPath("some/location");

// Assert
Assertions.assertEquals("s3://testBucket/some/location", path);
}

@Test
void testGetPathStorageConnectorWithPath() throws FeatureStoreException, IOException {
// Arrange
S3Connector connector = new S3Connector();
connector.setBucket("testBucket");
connector.setPath("abc/def");

// Act
String path = connector.getPath("some/location");

// Assert
Assertions.assertEquals("s3://testBucket/abc/def/some/location", path);
}
}

@Nested
Expand Down
2 changes: 1 addition & 1 deletion python/tests/test_storage_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def test_default_path(self, mocker):
sc.read(data_format="csv")
# assert
assert "" == mock_engine_read.call_args[0][3]

def test_get_path(self, mocker):
mocker.patch("hsfs.engine.get_instance", return_value=spark.Engine())
sc = storage_connector.S3Connector(
Expand Down

0 comments on commit f2bbc87

Please sign in to comment.