Linting #509
@@ -369,9 +369,18 @@ func TestCreateLocalFileStorage(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestCreateLocalFileStorage_InvalidPath(t *testing.T) {
|
func TestCreateLocalFileStorage_InvalidPath(t *testing.T) {
|
||||||
|
// Build a deterministic failure case: the target path already exists as a file.
|
||||||
|
tempDir, err := os.MkdirTemp("", "storage_invalid_path_test")
|
||||||
|
require.NoError(t, err)
|
||||||
|
defer os.RemoveAll(tempDir)
|
||||||
|
|
||||||
|
fileAtTargetPath := filepath.Join(tempDir, "test")
|
||||||
|
err = os.WriteFile(fileAtTargetPath, []byte("not a directory"), 0o644)
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
logger := zap.NewNop()
|
logger := zap.NewNop()
|
||||||
cfg := config.LocalFSSConfig{
|
cfg := config.LocalFSSConfig{
|
||||||
RootPath: "/invalid/path/that/does/not/exist/and/should/fail",
|
RootPath: tempDir,
|
||||||
}
|
}
|
||||||
|
|
||||||
storage, err := CreateLocalFileStorage(logger, mservice.Storage, "test", "sub", &mockDomainProvider{}, cfg)
|
storage, err := CreateLocalFileStorage(logger, mservice.Storage, "test", "sub", &mockDomainProvider{}, cfg)
|
||||||
|
|||||||
Reference in New Issue
Block a user