[
https://issues.apache.org/jira/browse/BEAM-12970?focusedWorklogId=670970&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-670970
]
ASF GitHub Bot logged work on BEAM-12970:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 27/Oct/21 19:07
Start Date: 27/Oct/21 19:07
Worklog Time Spent: 10m
Work Description: pabloem commented on a change in pull request #15803:
URL: https://github.com/apache/beam/pull/15803#discussion_r737760119
##########
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:
I'm just a little confused - does this actually run some Java code? I
think it will run `java` and `javac`, right?
##########
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:
oh I guess this test does not actually run it - can you add a comment
about what this test checks so that it's easy to read for others? thanks!
--
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]
Issue Time Tracking
-------------------
Worklog Id: (was: 670970)
Remaining Estimate: 5h 20m (was: 5.5h)
Time Spent: 2h 40m (was: 2.5h)
> [Playground] Implement gRPC API
> -------------------------------
>
> Key: BEAM-12970
> URL: https://issues.apache.org/jira/browse/BEAM-12970
> Project: Beam
> Issue Type: Sub-task
> Components: beam-playground
> Reporter: Ilya Kozyrev
> Assignee: Pavel Avilov
> Priority: P3
> Labels: beam-playground-sprint-2
> Original Estimate: 8h
> Time Spent: 2h 40m
> Remaining Estimate: 5h 20m
>
> Need to implement gRPC endpoints to communicate with frontend app:
> * implement RunCode(RunCodeRequest) returns (RunCodeResponse)
> * implement CheckStatus(CheckStatusRequest) returns (CheckStatusResponse)
> * implement GetRunOutput(GetRunOutputRequest) returns (GetRunOutputResponse)
> * implement GetCompileOutput(GetCompileOutputRequest) returns
> (GetCompileOutputResponse)
>
> The server should handle the following types of requests:
> * Take the request to run code
> * Send a response to the client with output
> * Send errors to the client
> * Send statuses of code execution/compilation
> Also, error codes and error messages should be implemented.
> All methods/functions should be covered with Unit Tests.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)