Use the same local file system instance for all files (#1070)

* Use the same local file system instance for all files

* Add test
This commit is contained in:
Jonatan Kłosko 2022-03-24 14:09:17 +01:00 committed by GitHub
parent 1fab2f54bf
commit 894ff15419
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View file

@ -49,7 +49,7 @@ defmodule Livebook.FileSystem.File do
"""
@spec local(FileSystem.path()) :: t()
def local(path) do
new(FileSystem.Local.new(), path)
new(Livebook.Config.local_filesystem(), path)
end
@doc """

View file

@ -30,6 +30,12 @@ defmodule Livebook.FileSystem.FileTest do
end
end
describe "local/1" do
test "uses the globally configured local file system instance" do
assert FileSystem.File.local("/path").file_system == Livebook.Config.local_filesystem()
end
end
describe "relative/2" do
test "ignores the file path if an absolute path is given" do
file_system = FileSystem.Local.new()