AydarZaynutdinov commented on a change in pull request #15803:
URL: https://github.com/apache/beam/pull/15803#discussion_r738032201
##########
File path: playground/backend/cmd/server/controller_test.go
##########
@@ -49,28 +101,86 @@ func setup() *grpc.Server {
func teardown(server *grpc.Server) {
server.Stop()
+
+ err := os.RemoveAll("configs")
+ if err != nil {
+ fmt.Errorf("error during test setup: %s", err.Error())
+ }
}
func bufDialer(context.Context, string) (net.Conn, error) {
return lis.Dial()
}
+
func TestPlaygroundController_RunCode(t *testing.T) {
- ctx := context.Background()
- conn, err := grpc.DialContext(ctx, "bufnet",
grpc.WithContextDialer(bufDialer), grpc.WithInsecure())
- if err != nil {
- t.Fatalf("Failed to dial bufnet: %v", err)
+ type args struct {
+ ctx context.Context
+ request *pb.RunCodeRequest
}
- defer conn.Close()
- client := pb.NewPlaygroundServiceClient(conn)
- code := pb.RunCodeRequest{
- Code: "test",
- Sdk: pb.Sdk_SDK_JAVA,
+ tests := []struct {
+ name string
+ args args
+ wantStatus pb.Status
+ wantErr bool
+ }{
+ {
+ name: "RunCode with incorrect sdk",
+ args: args{
+ ctx: context.Background(),
+ request: &pb.RunCodeRequest{
+ Code: "MOCK_CODE",
+ Sdk: pb.Sdk_SDK_UNSPECIFIED,
+ },
+ },
+ wantErr: true,
+ },
+ {
+ name: "RunCode with correct sdk",
+ args: args{
+ ctx: context.Background(),
+ request: &pb.RunCodeRequest{
+ Code: "MOCK_CODE",
Review comment:
Added.
--
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]