Skip to content

Commit

Permalink
fix go fs test
Browse files Browse the repository at this point in the history
  • Loading branch information
meowjesty committed Jan 9, 2025
1 parent 3f4a0a6 commit bf1073a
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions tests/go-e2e-dir/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,20 @@ func main() {
os.Exit(-1)
}
fmt.Printf("DirEntries: %s\n", dir)

// `os.ReadDir` does not include `.` and `..`.
if len(dir) != 2 {
if len(dir) < 2 {
os.Exit(-1)
}
// `os.ReadDir` sorts the result by file name.
if dir[0].Name() != "app.py" || dir[1].Name() != "test.txt" {
os.Exit(-1)

// Iterate over the files in this dir, exiting if it's not an expected file name.
for i := 0; i < len(dir); i++ {
dirName := dir[i].Name()

if dirName != "app.py" && dirName != "test.txt" && dirName != "file.local" && dirName != "file.not-found" && dirName != "file.read-only" && dirName != "file.read-write" {
os.Exit(-1)
}

}

err = os.Mkdir("/app/test_mkdir", 0755)
Expand Down

0 comments on commit bf1073a

Please sign in to comment.