mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-07-21 14:28:54 -04:00
Add getState to protoClient
This commit is contained in:
parent
c08787ce80
commit
019003337f
4 changed files with 80 additions and 1 deletions
|
@ -8,6 +8,7 @@ import (
|
|||
|
||||
"github.com/edgelesssys/constellation/cli/proto"
|
||||
"github.com/edgelesssys/constellation/coordinator/atls"
|
||||
"github.com/edgelesssys/constellation/coordinator/state"
|
||||
)
|
||||
|
||||
type stubProtoClient struct {
|
||||
|
@ -15,8 +16,10 @@ type stubProtoClient struct {
|
|||
respClient proto.ActivationResponseClient
|
||||
connectErr error
|
||||
closeErr error
|
||||
getStateErr error
|
||||
activateErr error
|
||||
|
||||
getStateState state.State
|
||||
activateUserPublicKey []byte
|
||||
activateMasterSecret []byte
|
||||
activateNodeIPs []string
|
||||
|
@ -35,6 +38,10 @@ func (c *stubProtoClient) Close() error {
|
|||
return c.closeErr
|
||||
}
|
||||
|
||||
func (c *stubProtoClient) GetState(_ context.Context) (state.State, error) {
|
||||
return c.getStateState, c.getStateErr
|
||||
}
|
||||
|
||||
func (c *stubProtoClient) Activate(ctx context.Context, userPublicKey, masterSecret []byte, nodeIPs, coordinatorIPs []string, autoscalingNodeGroups []string, cloudServiceAccountURI string) (proto.ActivationResponseClient, error) {
|
||||
c.activateUserPublicKey = userPublicKey
|
||||
c.activateMasterSecret = masterSecret
|
||||
|
@ -112,7 +119,14 @@ func (c *fakeProtoClient) Close() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (c *fakeProtoClient) Activate(ctx context.Context, userPublicKey, masterSecret []byte, nodeIPs, coordinatorIPs []string, autoscalingNodeGroups []string, cloudServiceAccountURI string) (proto.ActivationResponseClient, error) {
|
||||
func (c *fakeProtoClient) GetState(_ context.Context) (state.State, error) {
|
||||
if !c.conn {
|
||||
return state.Uninitialized, errors.New("client is not connected")
|
||||
}
|
||||
return state.IsNode, nil
|
||||
}
|
||||
|
||||
func (c *fakeProtoClient) Activate(ctx context.Context, userPublicKey, masterSecret []byte, nodeIPs, coordinatorIPs, autoscalingNodeGroups []string, cloudServiceAccountURI string) (proto.ActivationResponseClient, error) {
|
||||
if !c.conn {
|
||||
return nil, errors.New("client is not connected")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue