TSultanov commented on code in PR #24874:
URL: https://github.com/apache/beam/pull/24874#discussion_r1083933022


##########
playground/backend/internal/fs_tool/java_fs_test.go:
##########
@@ -85,15 +85,39 @@ func Test_executableName(t *testing.T) {
        workDir := "workingDir"
        preparedPipelinesFolder := filepath.Join(workDir, pipelinesFolder)
        lc := newJavaLifeCycle(pipelineId, preparedPipelinesFolder)
-       lc.CreateFolders()
-       defer os.RemoveAll(workDir)
+       err := lc.CreateFolders()
+       if err != nil {
+               panic(err)
+       }
+       defer func() {
+               err := os.RemoveAll(workDir)
+               if err != nil {
+                       panic(err)
+               }
+       }()
+
+       cleanupFunc := func() {
+               compiled := filepath.Join(workDir, pipelinesFolder, 
pipelineId.String(), compiledFolderName)
+               dirEntries, err := os.ReadDir(compiled)
+               if err != nil {
+                       panic(err)
+               }
+
+               for _, entry := range dirEntries {
+                       err := os.Remove(filepath.Join(compiled, entry.Name()))
+                       if err != nil {
+                               panic(err)
+                       }
+               }
+       }
 
        type args struct {
                executableFolder string
        }
        tests := []struct {
                name    string
                prepare func()
+               cleanup func()
                args    args
                want    string
                wantErr bool

Review Comment:
   There are couple:
   
https://github.com/apache/beam/blob/0b3b2b6e3595d69bb9f8b4cf38975c8b97f1847b/playground/backend/internal/fs_tool/java_fs_test.go#L135
   
https://github.com/apache/beam/blob/0b3b2b6e3595d69bb9f8b4cf38975c8b97f1847b/playground/backend/internal/fs_tool/java_fs_test.go#L166



-- 
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]

Reply via email to