From 9e393b0fe78edb67c04dbd265dee2c2e0c5f4f8e Mon Sep 17 00:00:00 2001 From: gabrielcorado Date: Mon, 18 Jan 2021 18:04:14 -0300 Subject: [PATCH 1/2] feat(app): add `IsRunning` function --- app.go | 8 ++++++++ mocks/app.go | 14 ++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/app.go b/app.go index e1e115c9..9eca2d65 100644 --- a/app.go +++ b/app.go @@ -87,6 +87,7 @@ type Pitaya interface { StartWorker() RegisterRPCJob(rpcJob worker.RPCJob) error Documentation(getPtrNames bool) (map[string]interface{}, error) + IsRunning() bool RPC(ctx context.Context, routeStr string, reply proto.Message, arg proto.Message) error RPCTo(ctx context.Context, serverID, routeStr string, reply proto.Message, arg proto.Message) error @@ -252,6 +253,13 @@ func (app *App) GetServers() []*cluster.Server { return app.serviceDiscovery.GetServers() } +// IsRunning indicates if the Pitaya app has been initialized. Note: This +// doesn't cover acceptors, only the pitaya internal registration and modules +// initialization. +func (app *App) IsRunning() bool { + return app.running +} + // SetLogger logger setter func SetLogger(l logging.Logger) { logger.Log = l diff --git a/mocks/app.go b/mocks/app.go index 46e8cd62..7deb8bd0 100644 --- a/mocks/app.go +++ b/mocks/app.go @@ -358,6 +358,20 @@ func (mr *MockPitayaMockRecorder) GroupRenewTTL(arg0, arg1 interface{}) *gomock. return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GroupRenewTTL", reflect.TypeOf((*MockPitaya)(nil).GroupRenewTTL), arg0, arg1) } +// IsRunning mocks base method +func (m *MockPitaya) IsRunning() bool { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "IsRunning") + ret0, _ := ret[0].(bool) + return ret0 +} + +// IsRunning indicates an expected call of IsRunning +func (mr *MockPitayaMockRecorder) IsRunning() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsRunning", reflect.TypeOf((*MockPitaya)(nil).IsRunning)) +} + // RPC mocks base method func (m *MockPitaya) RPC(arg0 context.Context, arg1 string, arg2, arg3 proto.Message) error { m.ctrl.T.Helper() From e246d2703a88d91850e09eb1344094e55055fe2a Mon Sep 17 00:00:00 2001 From: gabrielcorado Date: Mon, 18 Jan 2021 18:19:55 -0300 Subject: [PATCH 2/2] fix(github): fix branch name --- .github/workflows/tests.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 6c01296c..270a36c3 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -3,10 +3,10 @@ name: Tests on: push: branches: - - master + - v2 pull_request: branches: - - master + - v2 jobs: deps: