9 Commits

Author SHA1 Message Date
Miguel Pires
aa623a49ea many: remove unused parameters and returns 2021-09-02 17:44:34 +01:00
Samuele Pedroni
7aa0362582 daemon: introduce apiBaseSuite.(json|sync|async|error)Req
these test a daemon request and check the expected response type
before returning the response for further specific checks

this simplifies away some checks in the tests but the bigger win is
avoiding the .(*daemon.Resp) casts everywhere, in particular
this will reduce the number of affected places if we change
somewhat the internal types used to produce responses
2021-03-31 17:26:49 +02:00
Samuele Pedroni
3b7e703f84 daemon: move the last api_foo_test.go to daemon_test
still todo later: clean up what is left in api.go and api_test.go

there are other non api_ tests also still in daemon
2021-03-01 18:33:14 +01:00
Samuele Pedroni
df8ca3c330 daemon: move apiBaseSuite to its own api_base_test.go
APIBaseSuite will be used for a while both from daemon
an daemon_test, so opt to make some field exported
for now at least

also use AddCleanup more and correctly

some cleanups in api_users_test.go in preparation to make
live in daemon_test
2020-11-20 20:16:42 +01:00
Samuele Pedroni
7ffffb1674 cmd/snap: display the error in snap debug seeding if seeding is in error (#9091)
For this include a seed-error in the /v2/debug?aspect=seeding debug API as well.

* daemon: support seed-error in /v2/debug?aspect=seeding
* cmd/snap: print seed-error if there is one in snap debug seeding
* cmd/snap: adjust seed-error test to new -- placeholder
2020-08-05 17:06:43 +02:00
Ian Johnson
e95457f05f daemon/api: use pointers to time.Time for debug seeding aspect
This, in conjunction with the associated change to `snap debug seeding` client
will help in determining when to output "-" for a time / duration that can't be
calculated because the start time is 0 and the end time is an actual time for
example, where now we output unexpected things like seeding taking 292 years,
instead we could just output `seed-completion: -`

Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
2020-07-29 07:28:11 -05:00
Ian Johnson
8632ea8370 daemon/api_debug: rename aspect=seeding-info to aspect=seeding
Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
2020-07-23 07:24:57 -05:00
Ian Johnson
a11be98dd9 daemon/api_debug_seeding.go: adjust names of fields as per code-review
Also return internal error on key errors

Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
2020-07-22 14:16:58 -05:00
Paweł Stołowski
8f985216ea Add seeding debug api. 2020-07-17 12:45:08 +02:00