Skip to content

Commit

Permalink
(feat): Skip mount point quuerying if not provided
Browse files Browse the repository at this point in the history
  • Loading branch information
lasith-kg committed Jan 3, 2024
1 parent 36cb0a9 commit e6601c7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/backend/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ func (lfb *LinuxFileBackend) From(config *config.Config) error {

files := map[string]*model.File{}
for _, cd := range config.Devices {
if len(cd.MountPoint) == 0 {
continue
}
// For certain file operations (like lfb.IsMount()) it is essential
// that we can query the parent directory. Therefore, lets pull the
// state of the parent directory of the mount point
Expand Down
10 changes: 10 additions & 0 deletions internal/backend/file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,16 @@ func TestLinuxFileBackendFrom(t *testing.T) {
},
ExpectedError: nil,
},
{
Name: "Skip + No Mount Point Provided",
Config: &config.Config{
Devices: map[string]config.Device{
"/dev/xvdf": {},
},
},
ExpectedOutput: map[string]*model.File{},
ExpectedError: nil,
},
{
Name: "Failure to Retrieve File Information",
Config: &config.Config{
Expand Down

0 comments on commit e6601c7

Please sign in to comment.