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 {
|
||||
apiWorker := api.Worker{
|
||||
Id: dbWorker.UUID,
|
||||
WorkerSummary: api.WorkerSummary{
|
||||
Id: dbWorker.UUID,
|
||||
Nickname: dbWorker.Name,
|
||||
Status: dbWorker.Status,
|
||||
Version: dbWorker.Software,
|
||||
},
|
||||
IpAddress: dbWorker.Address,
|
||||
Nickname: dbWorker.Name,
|
||||
Platform: dbWorker.Platform,
|
||||
Status: dbWorker.Status,
|
||||
SupportedTaskTypes: dbWorker.TaskTypes(),
|
||||
Version: dbWorker.Software,
|
||||
}
|
||||
|
||||
if dbWorker.StatusRequested != "" {
|
||||
|
@ -87,12 +87,14 @@ func TestFetchWorker(t *testing.T) {
|
||||
err = mf.flamenco.FetchWorker(echo, workerUUID)
|
||||
assert.NoError(t, err)
|
||||
assertResponseJSON(t, echo, http.StatusOK, api.Worker{
|
||||
Id: workerUUID,
|
||||
Nickname: "дрон",
|
||||
WorkerSummary: api.WorkerSummary{
|
||||
Id: workerUUID,
|
||||
Nickname: "дрон",
|
||||
Version: "3.0",
|
||||
Status: api.WorkerStatusAwake,
|
||||
},
|
||||
IpAddress: "fe80::5054:ff:fede:2ad7",
|
||||
Platform: "linux",
|
||||
Version: "3.0",
|
||||
Status: api.WorkerStatusAwake,
|
||||
SupportedTaskTypes: []string{"blender", "ffmpeg", "file-management", "misc"},
|
||||
})
|
||||
|
||||
@ -105,13 +107,15 @@ func TestFetchWorker(t *testing.T) {
|
||||
err = mf.flamenco.FetchWorker(echo, worker.UUID)
|
||||
assert.NoError(t, err)
|
||||
assertResponseJSON(t, echo, http.StatusOK, api.Worker{
|
||||
Id: workerUUID,
|
||||
Nickname: "дрон",
|
||||
WorkerSummary: api.WorkerSummary{
|
||||
Id: workerUUID,
|
||||
Nickname: "дрон",
|
||||
Version: "3.0",
|
||||
Status: api.WorkerStatusAwake,
|
||||
StatusRequested: &requestedStatus,
|
||||
},
|
||||
IpAddress: "fe80::5054:ff:fede:2ad7",
|
||||
Platform: "linux",
|
||||
Version: "3.0",
|
||||
Status: api.WorkerStatusAwake,
|
||||
StatusRequested: &requestedStatus,
|
||||
SupportedTaskTypes: []string{"blender", "ffmpeg", "file-management", "misc"},
|
||||
})
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user