You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by "TSultanov (via GitHub)" <gi...@apache.org> on 2023/01/23 11:20:30 UTC

[GitHub] [beam] TSultanov commented on a diff in pull request #24874: [Playground] Implement Java & Go multifile examples execution

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: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org