forked from cadence-workflow/cadence
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add onebox host and use it to run integration test
Summary: This revision adds a host that starts all cadence services in a single process. It also wires the integration test to communicate with the one-box hosted cadence frontend. The integration test is now controlled by a flag. By default it won't run unless that flag is set to true, because it takes too much time. Test Plan: Integration test is passing Reviewers: samar, sivakk Reviewed By: sivakk Subscribers: jenkins Differential Revision: https://code.uberinternal.com/D700756
- Loading branch information
Tamer Eldeeb
committed
Jan 13, 2017
1 parent
07738de
commit ef7d0ba
Showing
15 changed files
with
368 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
package frontend | ||
|
||
import ( | ||
"time" | ||
|
||
"golang.org/x/net/context" | ||
|
||
m "code.uber.internal/devexp/minions/.gen/go/minions" | ||
workflow "code.uber.internal/devexp/minions/.gen/go/shared" | ||
tchannel "github.com/uber/tchannel-go" | ||
"github.com/uber/tchannel-go/thrift" | ||
) | ||
|
||
const frontendServiceName = "cadence-frontend" | ||
|
||
var _ Client = (*clientImpl)(nil) | ||
|
||
type clientImpl struct { | ||
connection *tchannel.Channel | ||
client m.TChanWorkflowService | ||
} | ||
|
||
// NewClient creates a new frontend TChannel client | ||
func NewClient(ch *tchannel.Channel, hostPort string) (Client, error) { | ||
var opts *thrift.ClientOptions | ||
if hostPort != "" { | ||
opts = &thrift.ClientOptions{ | ||
HostPort: hostPort, | ||
} | ||
} | ||
tClient := thrift.NewClient(ch, frontendServiceName, opts) | ||
|
||
client := &clientImpl{ | ||
connection: ch, | ||
client: m.NewTChanWorkflowServiceClient(tClient), | ||
} | ||
return client, nil | ||
} | ||
|
||
func (c *clientImpl) createContext() (thrift.Context, context.CancelFunc) { | ||
// TODO: make timeout configurable | ||
return thrift.NewContext(time.Minute * 3) | ||
} | ||
|
||
func (c *clientImpl) StartWorkflowExecution(request *workflow.StartWorkflowExecutionRequest) (*workflow.StartWorkflowExecutionResponse, error) { | ||
ctx, cancel := c.createContext() | ||
defer cancel() | ||
return c.client.StartWorkflowExecution(ctx, request) | ||
} | ||
|
||
func (c *clientImpl) GetWorkflowExecutionHistory( | ||
request *workflow.GetWorkflowExecutionHistoryRequest) (*workflow.GetWorkflowExecutionHistoryResponse, error) { | ||
ctx, cancel := c.createContext() | ||
defer cancel() | ||
return c.client.GetWorkflowExecutionHistory(ctx, request) | ||
} | ||
|
||
func (c *clientImpl) PollForActivityTask(pollRequest *workflow.PollForActivityTaskRequest) (*workflow.PollForActivityTaskResponse, error) { | ||
ctx, cancel := c.createContext() | ||
defer cancel() | ||
return c.client.PollForActivityTask(ctx, pollRequest) | ||
} | ||
|
||
func (c *clientImpl) PollForDecisionTask(pollRequest *workflow.PollForDecisionTaskRequest) (*workflow.PollForDecisionTaskResponse, error) { | ||
ctx, cancel := c.createContext() | ||
defer cancel() | ||
return c.client.PollForDecisionTask(ctx, pollRequest) | ||
} | ||
|
||
func (c *clientImpl) RecordActivityTaskHeartbeat(heartbeatRequest *workflow.RecordActivityTaskHeartbeatRequest) (*workflow.RecordActivityTaskHeartbeatResponse, error) { | ||
ctx, cancel := c.createContext() | ||
defer cancel() | ||
return c.client.RecordActivityTaskHeartbeat(ctx, heartbeatRequest) | ||
} | ||
|
||
func (c *clientImpl) RespondDecisionTaskCompleted(request *workflow.RespondDecisionTaskCompletedRequest) error { | ||
ctx, cancel := c.createContext() | ||
defer cancel() | ||
return c.client.RespondDecisionTaskCompleted(ctx, request) | ||
} | ||
|
||
func (c *clientImpl) RespondActivityTaskCompleted(request *workflow.RespondActivityTaskCompletedRequest) error { | ||
ctx, cancel := c.createContext() | ||
defer cancel() | ||
return c.client.RespondActivityTaskCompleted(ctx, request) | ||
} | ||
|
||
func (c *clientImpl) RespondActivityTaskFailed(request *workflow.RespondActivityTaskFailedRequest) error { | ||
ctx, cancel := c.createContext() | ||
defer cancel() | ||
return c.client.RespondActivityTaskFailed(ctx, request) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package frontend | ||
|
||
import ( | ||
"code.uber.internal/devexp/minions/.gen/go/shared" | ||
) | ||
|
||
// Client is the interface exposed by frontend service client | ||
type Client interface { | ||
GetWorkflowExecutionHistory(getRequest *shared.GetWorkflowExecutionHistoryRequest) (*shared.GetWorkflowExecutionHistoryResponse, error) | ||
PollForActivityTask(pollRequest *shared.PollForActivityTaskRequest) (*shared.PollForActivityTaskResponse, error) | ||
PollForDecisionTask(pollRequest *shared.PollForDecisionTaskRequest) (*shared.PollForDecisionTaskResponse, error) | ||
RecordActivityTaskHeartbeat(heartbeatRequest *shared.RecordActivityTaskHeartbeatRequest) (*shared.RecordActivityTaskHeartbeatResponse, error) | ||
RespondActivityTaskCompleted(completeRequest *shared.RespondActivityTaskCompletedRequest) error | ||
RespondActivityTaskFailed(failRequest *shared.RespondActivityTaskFailedRequest) error | ||
RespondDecisionTaskCompleted(completeRequest *shared.RespondDecisionTaskCompletedRequest) error | ||
StartWorkflowExecution(startRequest *shared.StartWorkflowExecutionRequest) (*shared.StartWorkflowExecutionResponse, error) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.