-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RSDK-9440 Report machine state
through GetMachineStatus
#4616
Changes from all commits
9026f00
53b9d29
4802b8d
8fa9830
c78e16e
62c3f5e
3b9d6b9
d97e583
58b4b94
eacd561
4948b13
d756396
fcf03b5
09b76fd
35f8f3d
e299ab4
19f7940
d68e6f4
2d8bc1b
f997bbb
f97feef
72bada6
fc67364
18555b3
e46aa9d
7f0fffd
da02e54
2c591ad
d5e484f
5bed7f2
e00ad7d
3e6e59e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -107,8 +107,11 @@ func TestClientSessionOptions(t *testing.T) { | |
return &dummyEcho{Named: arbName.AsNamed()}, nil | ||
}, | ||
ResourceRPCAPIsFunc: func() []resource.RPCAPI { return nil }, | ||
LoggerFunc: func() logging.Logger { return logger }, | ||
SessMgr: sessMgr, | ||
MachineStatusFunc: func(_ context.Context) (robot.MachineStatus, error) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I inject an almost identical I thought about placing this functionality in |
||
return robot.MachineStatus{State: robot.StateRunning}, nil | ||
}, | ||
LoggerFunc: func() logging.Logger { return logger }, | ||
SessMgr: sessMgr, | ||
} | ||
|
||
svc := web.New(injectRobot, logger) | ||
|
@@ -129,13 +132,11 @@ func TestClientSessionOptions(t *testing.T) { | |
Disable: true, | ||
}))) | ||
} | ||
roboClient, err := client.New(ctx, addr, logger, opts...) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In three of the client session tests, I had to move the instantiation of the robot client to be below the injection of the session manager. I'd like to meet offline at some point to walk through There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I'm fine not touching this in the current PR. But are we currently aware of a reason why There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
As far as I can tell, we only rely on There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Makes sense -- in hindsight i wish the scope listed out all of the actuating (or non-actuating, if that's easier) API calls as of the time of writing. |
||
test.That(t, err, test.ShouldBeNil) | ||
|
||
injectRobot.Mu.Lock() | ||
injectRobot.MachineStatusFunc = func(ctx context.Context) (robot.MachineStatus, error) { | ||
session.SafetyMonitorResourceName(ctx, someTargetName1) | ||
return robot.MachineStatus{}, nil | ||
return robot.MachineStatus{State: robot.StateRunning}, nil | ||
} | ||
injectRobot.Mu.Unlock() | ||
|
||
|
@@ -179,6 +180,8 @@ func TestClientSessionOptions(t *testing.T) { | |
} | ||
sessMgr.mu.Unlock() | ||
|
||
roboClient, err := client.New(ctx, addr, logger, opts...) | ||
test.That(t, err, test.ShouldBeNil) | ||
resp, err := roboClient.MachineStatus(nextCtx) | ||
test.That(t, err, test.ShouldBeNil) | ||
test.That(t, resp, test.ShouldNotBeNil) | ||
|
@@ -289,6 +292,9 @@ func TestClientSessionExpiration(t *testing.T) { | |
ResourceByNameFunc: func(name resource.Name) (resource.Resource, error) { | ||
return &dummyEcho1, nil | ||
}, | ||
MachineStatusFunc: func(_ context.Context) (robot.MachineStatus, error) { | ||
return robot.MachineStatus{State: robot.StateRunning}, nil | ||
}, | ||
ResourceRPCAPIsFunc: func() []resource.RPCAPI { return nil }, | ||
LoggerFunc: func() logging.Logger { return logger }, | ||
SessMgr: sessMgr, | ||
|
@@ -306,8 +312,6 @@ func TestClientSessionExpiration(t *testing.T) { | |
Disable: true, | ||
}))) | ||
} | ||
roboClient, err := client.New(ctx, addr, logger, opts...) | ||
test.That(t, err, test.ShouldBeNil) | ||
|
||
injectRobot.Mu.Lock() | ||
var capSessID uuid.UUID | ||
|
@@ -317,7 +321,7 @@ func TestClientSessionExpiration(t *testing.T) { | |
panic("expected session") | ||
} | ||
capSessID = sess.ID() | ||
return robot.MachineStatus{}, nil | ||
return robot.MachineStatus{State: robot.StateRunning}, nil | ||
} | ||
injectRobot.Mu.Unlock() | ||
|
||
|
@@ -372,6 +376,8 @@ func TestClientSessionExpiration(t *testing.T) { | |
} | ||
sessMgr.mu.Unlock() | ||
|
||
roboClient, err := client.New(ctx, addr, logger, opts...) | ||
test.That(t, err, test.ShouldBeNil) | ||
resp, err := roboClient.MachineStatus(nextCtx) | ||
test.That(t, err, test.ShouldBeNil) | ||
test.That(t, resp, test.ShouldNotBeNil) | ||
|
@@ -480,8 +486,11 @@ func TestClientSessionResume(t *testing.T) { | |
injectRobot := &inject.Robot{ | ||
ResourceNamesFunc: func() []resource.Name { return []resource.Name{} }, | ||
ResourceRPCAPIsFunc: func() []resource.RPCAPI { return nil }, | ||
LoggerFunc: func() logging.Logger { return logger }, | ||
SessMgr: sessMgr, | ||
MachineStatusFunc: func(_ context.Context) (robot.MachineStatus, error) { | ||
return robot.MachineStatus{State: robot.StateRunning}, nil | ||
}, | ||
LoggerFunc: func() logging.Logger { return logger }, | ||
SessMgr: sessMgr, | ||
} | ||
|
||
svc := web.New(injectRobot, logger) | ||
|
@@ -496,8 +505,6 @@ func TestClientSessionResume(t *testing.T) { | |
Disable: true, | ||
}))) | ||
} | ||
roboClient, err := client.New(ctx, addr, logger, opts...) | ||
test.That(t, err, test.ShouldBeNil) | ||
|
||
var capMu sync.Mutex | ||
var startCalled int | ||
|
@@ -536,10 +543,12 @@ func TestClientSessionResume(t *testing.T) { | |
panic("expected session") | ||
} | ||
capSessID = sess.ID() | ||
return robot.MachineStatus{}, nil | ||
return robot.MachineStatus{State: robot.StateRunning}, nil | ||
} | ||
injectRobot.Mu.Unlock() | ||
|
||
roboClient, err := client.New(ctx, addr, logger, opts...) | ||
test.That(t, err, test.ShouldBeNil) | ||
resp, err := roboClient.MachineStatus(nextCtx) | ||
test.That(t, err, test.ShouldBeNil) | ||
test.That(t, resp, test.ShouldNotBeNil) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We were missing some code to marshal and unmarshal the
PackagePath
field. I needed that functionality forTestMachineState
, so I just added it.