Skip to content

Commit

Permalink
address lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
funkyshu committed Jan 30, 2024
1 parent 8e27302 commit 51827a9
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 17 deletions.
2 changes: 1 addition & 1 deletion backend/testsuite/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func CopyOsLocation(loc vfs.Location) vfs.Location {
panic(err)
}
if !exists {
err := os.Mkdir(ret.Path(), 0755)
err := os.Mkdir(ret.Path(), 0750)
if err != nil {
panic(err)
}
Expand Down
40 changes: 24 additions & 16 deletions backend/testsuite/io_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,19 +126,25 @@ type ioTestSuite struct {
localDir string
}

/*
The following example shows how to setup the test suite to run against a local directory for unix file baseline
// setup local tests
osTemp, err := os.MkdirTemp("", "vfs-io-test")
s.Require().NoError(err)
// add baseline OS test
loc := osTemp + "/"
uris = append(uris, loc)
// add vfs os test
loc = "file://" + loc
uris = append(uris, loc)
*/

func (s *ioTestSuite) SetupSuite() {
uris := make([]string, 0)
// // setup local tests
// osTemp, err := os.MkdirTemp("", "vfs-io-test")
// s.Require().NoError(err)
//
// // add baseline OS test
// loc := osTemp + "/"
// uris = append(uris, loc)
//
// // add vfs os test
// loc = "file://" + loc
// uris = append(uris, loc)

// add VFS_INTEGRATION_LOCATIONS tests
locs := os.Getenv("VFS_INTEGRATION_LOCATIONS")
Expand Down Expand Up @@ -382,6 +388,7 @@ func (s *ioTestSuite) testFileOperations(testPath string) {
}
}

//nolint:gocyclo
func executeSequence(t *testing.T, file ReadWriteSeekCloseURINamer, sequence string) (string, error) {
// split sequence by semicolon
commands := strings.Split(sequence, ";")
Expand Down Expand Up @@ -452,16 +459,17 @@ SEQ:
}

var f io.ReadCloser
if osfile, ok := file.(*OSWrapper); ok {

switch assertedFile := file.(type) {
case *OSWrapper:
var err error
f, err = os.Open(osfile.URI())
f, err = os.Open(assertedFile.URI())
if err != nil {
t.Fatalf("error opening file: %s", err.Error())
}
} else if vfsFile, ok := file.(vfs.File); ok {
// open new file
case vfs.File:
var err error
f, err = vfsFile.Location().NewFile(file.Name())
f, err = assertedFile.Location().NewFile(assertedFile.Name())
if err != nil {
t.Fatalf("error opening file: %s", err.Error())
}
Expand Down

0 comments on commit 51827a9

Please sign in to comment.