AydarZaynutdinov commented on a change in pull request #16374:
URL: https://github.com/apache/beam/pull/16374#discussion_r782780625
##########
File path: playground/backend/internal/fs_tool/fs_test.go
##########
@@ -30,132 +28,108 @@ import (
const (
sourceDir = "sourceDir"
destinationDir = "destinationDir"
+ testFileMode = 0755
pipelinesFolder = "executable_files"
)
-func TestMain(m *testing.M) {
- err := setupPreparedFiles()
- if err != nil {
- logger.Fatal(err)
- }
- defer teardown()
- m.Run()
-}
-
-func setupPreparedFiles() error {
- err := os.Mkdir(sourceDir, 0755)
+func prepareFiles() error {
+ err := os.Mkdir(sourceDir, testFileMode)
if err != nil {
return err
}
- err = os.Mkdir(destinationDir, 0755)
+ err = os.Mkdir(destinationDir, testFileMode)
if err != nil {
return err
}
filePath := filepath.Join(sourceDir, "file.txt")
_, err = os.Create(filePath)
- if err != nil {
- return err
- }
- return nil
+ return err
}
-func teardown() {
+func teardownFiles() error {
Review comment:
I have needed 2 methods to remove all prepared files and folders for 2
different tests `TestLifeCycle_CopyFile` and
`TestLifeCycle_CreateSourceCodeFile`.
`teardownFiles` removes files which were prepared for the
`TestLifeCycle_CopyFile` test.
`teardownFolders` removes files that were prepared for the
`TestLifeCycle_CreateSourceCodeFile` test.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]