Manager: store software version on worker sign-on
This commit is contained in:
parent
424e80163b
commit
90b567f97c
@ -106,6 +106,7 @@ func (f *Flamenco) workerUpdateAfterSignOn(e echo.Context, update api.SignOnJSON
|
|||||||
w.Status = api.WorkerStatusStarting
|
w.Status = api.WorkerStatusStarting
|
||||||
w.Address = e.RealIP()
|
w.Address = e.RealIP()
|
||||||
w.Name = update.Nickname
|
w.Name = update.Nickname
|
||||||
|
w.Software = update.SoftwareVersion
|
||||||
|
|
||||||
// Remove trailing spaces from task types, and convert to lower case.
|
// Remove trailing spaces from task types, and convert to lower case.
|
||||||
for idx := range update.SupportedTaskTypes {
|
for idx := range update.SupportedTaskTypes {
|
||||||
|
@ -89,6 +89,30 @@ func TestTaskScheduleOtherStatusRequested(t *testing.T) {
|
|||||||
assertResponseJSON(t, echoCtx, http.StatusLocked, expectBody)
|
assertResponseJSON(t, echoCtx, http.StatusLocked, expectBody)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestWorkerSignOn(t *testing.T) {
|
||||||
|
mockCtrl := gomock.NewController(t)
|
||||||
|
defer mockCtrl.Finish()
|
||||||
|
|
||||||
|
mf := newMockedFlamenco(mockCtrl)
|
||||||
|
worker := testWorker()
|
||||||
|
worker.Status = api.WorkerStatusOffline
|
||||||
|
|
||||||
|
mf.persistence.EXPECT().SaveWorker(gomock.Any(), &worker).Return(nil)
|
||||||
|
|
||||||
|
echo := mf.prepareMockedJSONRequest(api.WorkerSignOn{
|
||||||
|
Nickname: "Lazy Boi",
|
||||||
|
SoftwareVersion: "3.0-testing",
|
||||||
|
SupportedTaskTypes: []string{"testing", "sleeping", "snoozing"},
|
||||||
|
})
|
||||||
|
requestWorkerStore(echo, &worker)
|
||||||
|
err := mf.flamenco.SignOn(echo)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
|
||||||
|
assertResponseJSON(t, echo, http.StatusOK, api.WorkerStateChange{
|
||||||
|
StatusRequested: api.WorkerStatusAwake,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
func TestWorkerSignoffTaskRequeue(t *testing.T) {
|
func TestWorkerSignoffTaskRequeue(t *testing.T) {
|
||||||
mockCtrl := gomock.NewController(t)
|
mockCtrl := gomock.NewController(t)
|
||||||
defer mockCtrl.Finish()
|
defer mockCtrl.Finish()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user