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/06 11:59:41 UTC

[GitHub] [beam] daria-malkova commented on a change in pull request #16125: [BEAM-13322][Playground] Support Java Unit-tests

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



##########
File path: playground/backend/internal/code_processing/code_processing_test.go
##########
@@ -561,3 +568,66 @@ func Test_setJavaExecutableFile(t *testing.T) {
 		})
 	}
 }
+
+func Test_getRunOrTestCmd(t *testing.T) {
+	unitTests := make(map[string]bool, 1)
+	unitTests[validators.UnitTestValidatorName] = true
+
+	notUnitTests := make(map[string]bool, 1)
+	notUnitTests[validators.UnitTestValidatorName] = false
+
+	runEx := executors.NewExecutorBuilder().
+		WithRunner().
+		WithCommand("runCommand").
+		WithArgs([]string{"arg1"}).
+		Build()
+
+	testEx := executors.NewExecutorBuilder().
+		WithTestRunner().
+		WithCommand("testCommand").
+		WithArgs([]string{"arg1"}).
+		Build()
+
+	wantRunExec := exec.CommandContext(context.Background(), "runCommand", "arg1", "")
+	wantTestExec := exec.CommandContext(context.Background(), "testCommand", "arg1", "")
+
+	type args struct {
+		valResult      map[string]bool
+		executor       *executors.Executor
+		ctxWithTimeout context.Context
+	}
+
+	tests := []struct {
+		name string
+		args args
+		want *exec.Cmd
+	}{
+		{
+			//Get cmd objects with set run executor
+			name: "get run cmd",
+			args: args{
+				valResult:      notUnitTests,
+				executor:       &runEx,
+				ctxWithTimeout: context.Background(),
+			},
+			want: wantRunExec,
+		},
+		{
+			//Get cmd objects with set test executor
+			name: "get test cmd",
+			args: args{
+				valResult:      unitTests,
+				executor:       &testEx,
+				ctxWithTimeout: context.Background(),
+			},
+			want: wantTestExec,
+		},
+	}
+	for _, tt := range tests {
+		t.Run(tt.name, func(t *testing.T) {
+			if got := getExecuteCmd(tt.args.valResult, tt.args.executor, tt.args.ctxWithTimeout); !reflect.DeepEqual(got, tt.want) {

Review comment:
       Everything is fine, can't see the problem




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