You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2021/12/17 15:36:28 UTC

[GitHub] [beam] daria-malkova commented on a change in pull request #16273: [BEAM-13478][Playground][Bugfix] Fix java unit test

daria-malkova commented on a change in pull request #16273:
URL: https://github.com/apache/beam/pull/16273#discussion_r771490006



##########
File path: playground/backend/internal/preparators/go_preparators.go
##########
@@ -51,16 +54,15 @@ func formatCode(args ...interface{}) error {
 	return nil
 }
 
-func changeFileName(args ...interface{}) error {
+func changeGoTestFileName(args ...interface{}) error {
 	filePath := args[0].(string)
-	isUnitTest := args[1].(bool)
-	if isUnitTest {
+	validationResults := args[1].(*sync.Map)
+	isUnitTest, ok := validationResults.Load(validators.UnitTestValidatorName)
+	if ok && isUnitTest.(bool) {
 		testFileName := fmt.Sprintf("%s_test.%s", strings.Split(filePath, sep)[0], goName)
-		cmd := exec.Command(mvCmd, filePath, testFileName)
-		fmt.Println(cmd.String())
-		stdout, err := cmd.CombinedOutput()
+		err := os.Rename(filePath, testFileName)
 		if err != nil {
-			return errors.New(string(stdout))
+			return err

Review comment:
       Why? We return error form preparator and this will be proccesed later

##########
File path: playground/backend/internal/preparators/go_preparators.go
##########
@@ -51,16 +54,15 @@ func formatCode(args ...interface{}) error {
 	return nil
 }
 
-func changeFileName(args ...interface{}) error {
+func changeGoTestFileName(args ...interface{}) error {
 	filePath := args[0].(string)
-	isUnitTest := args[1].(bool)
-	if isUnitTest {
+	validationResults := args[1].(*sync.Map)
+	isUnitTest, ok := validationResults.Load(validators.UnitTestValidatorName)
+	if ok && isUnitTest.(bool) {
 		testFileName := fmt.Sprintf("%s_test.%s", strings.Split(filePath, sep)[0], goName)
-		cmd := exec.Command(mvCmd, filePath, testFileName)
-		fmt.Println(cmd.String())
-		stdout, err := cmd.CombinedOutput()
+		err := os.Rename(filePath, testFileName)
 		if err != nil {
-			return errors.New(string(stdout))
+			return err

Review comment:
       Why? We return error from preparator and this will be proccessed later




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