Manager: construct api.Worker
from api.WorkerSummary
+ extra fields
This commit is contained in:
parent
90707dceed
commit
3063e1fe6d
@ -68,13 +68,15 @@ func workerSummary(w persistence.Worker) api.WorkerSummary {
|
|||||||
|
|
||||||
func workerDBtoAPI(dbWorker *persistence.Worker) api.Worker {
|
func workerDBtoAPI(dbWorker *persistence.Worker) api.Worker {
|
||||||
apiWorker := api.Worker{
|
apiWorker := api.Worker{
|
||||||
|
WorkerSummary: api.WorkerSummary{
|
||||||
Id: dbWorker.UUID,
|
Id: dbWorker.UUID,
|
||||||
IpAddress: dbWorker.Address,
|
|
||||||
Nickname: dbWorker.Name,
|
Nickname: dbWorker.Name,
|
||||||
Platform: dbWorker.Platform,
|
|
||||||
Status: dbWorker.Status,
|
Status: dbWorker.Status,
|
||||||
SupportedTaskTypes: dbWorker.TaskTypes(),
|
|
||||||
Version: dbWorker.Software,
|
Version: dbWorker.Software,
|
||||||
|
},
|
||||||
|
IpAddress: dbWorker.Address,
|
||||||
|
Platform: dbWorker.Platform,
|
||||||
|
SupportedTaskTypes: dbWorker.TaskTypes(),
|
||||||
}
|
}
|
||||||
|
|
||||||
if dbWorker.StatusRequested != "" {
|
if dbWorker.StatusRequested != "" {
|
||||||
|
@ -87,12 +87,14 @@ func TestFetchWorker(t *testing.T) {
|
|||||||
err = mf.flamenco.FetchWorker(echo, workerUUID)
|
err = mf.flamenco.FetchWorker(echo, workerUUID)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assertResponseJSON(t, echo, http.StatusOK, api.Worker{
|
assertResponseJSON(t, echo, http.StatusOK, api.Worker{
|
||||||
|
WorkerSummary: api.WorkerSummary{
|
||||||
Id: workerUUID,
|
Id: workerUUID,
|
||||||
Nickname: "дрон",
|
Nickname: "дрон",
|
||||||
IpAddress: "fe80::5054:ff:fede:2ad7",
|
|
||||||
Platform: "linux",
|
|
||||||
Version: "3.0",
|
Version: "3.0",
|
||||||
Status: api.WorkerStatusAwake,
|
Status: api.WorkerStatusAwake,
|
||||||
|
},
|
||||||
|
IpAddress: "fe80::5054:ff:fede:2ad7",
|
||||||
|
Platform: "linux",
|
||||||
SupportedTaskTypes: []string{"blender", "ffmpeg", "file-management", "misc"},
|
SupportedTaskTypes: []string{"blender", "ffmpeg", "file-management", "misc"},
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -105,13 +107,15 @@ func TestFetchWorker(t *testing.T) {
|
|||||||
err = mf.flamenco.FetchWorker(echo, worker.UUID)
|
err = mf.flamenco.FetchWorker(echo, worker.UUID)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
assertResponseJSON(t, echo, http.StatusOK, api.Worker{
|
assertResponseJSON(t, echo, http.StatusOK, api.Worker{
|
||||||
|
WorkerSummary: api.WorkerSummary{
|
||||||
Id: workerUUID,
|
Id: workerUUID,
|
||||||
Nickname: "дрон",
|
Nickname: "дрон",
|
||||||
IpAddress: "fe80::5054:ff:fede:2ad7",
|
|
||||||
Platform: "linux",
|
|
||||||
Version: "3.0",
|
Version: "3.0",
|
||||||
Status: api.WorkerStatusAwake,
|
Status: api.WorkerStatusAwake,
|
||||||
StatusRequested: &requestedStatus,
|
StatusRequested: &requestedStatus,
|
||||||
|
},
|
||||||
|
IpAddress: "fe80::5054:ff:fede:2ad7",
|
||||||
|
Platform: "linux",
|
||||||
SupportedTaskTypes: []string{"blender", "ffmpeg", "file-management", "misc"},
|
SupportedTaskTypes: []string{"blender", "ffmpeg", "file-management", "misc"},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user