-
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
base: main
Are you sure you want to change the base?
Changes from 17 commits
fe92e07
bc21b4f
28b89db
a634d19
f7dd78c
48e6714
70a5096
a4d585d
c6374ad
53dde49
eaa1285
e6b8b44
d2dc450
b932fdf
aa1020e
60ab517
4d29ba8
afcfbee
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 |
||
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.
Lint won't pass locally without this for me.