28 Commits

Author SHA1 Message Date
Philip Meulengracht
7ec1160e91 asserts: add code for Fetcher to support the fetching of sequence-forming assertions (#12654)
* multiple: add code for Fetcher to support the fetching of sequence-forming assertions
* asserts: obviously not a typo as I read it
* asserts: add new SeqFetcher interface
* asserts: add docs to NewSeqFetcher
* asserts: remove ResolveLatest and open another PR
* asserts: cleanup some doc comments, make sure they fit their use-cases. Include Fetcher interface in SequenceFormingFetcher. Rename SeqFetcher to SequenceFormingFetcher and the new function. Do some additional renaming. Reuse some code between FetchSequence and Fetch.
* asserts: add an additional unit test to document current behavior of multiple sequences of same assertion.
* asserts: update docs for NewSequenceFormingFetcher, readd a line I had removed accidently, the sequence number must be set back to 2 after testing with sequence 4
* asserts: add docs for the multiple-sequence behavior, add missing doc line for SequenceFormingFetcher.
* asserts: add unit tests for detecting circular references, clarify some of the terminology around sequences

---------

Co-authored-by: Michael Vogt <mvo@ubuntu.com>
2023-03-22 11:28:25 +01:00
Zeyad Yasser
54c6a1d8c3 refactor: replace IsNotFound usages for errors.Is(err, &NotFoundError{}) 2023-02-09 16:02:40 +00:00
Miguel Pires
d097436c1c many: fix formatting w/ gofmt 1.19
Go 1.19 includes some changes to gofmt which intend to make lists and
heading clearer when rendered (https://go.dev/doc/go1.19). This commit
is the result of running the new gofmt and manually fixing some of it.
This was necessary because the new gofmt assumed lines beginning w/ tabs
to start lists or examples. While this is often true in our codebase,
we occasionally also use tabs to indent the lines after a TODO or FIXME
prefix or in yaml (e.g., excerpts of a snap.yaml). This meant that a lot of the
reformatted comments were broken and had to be fixed manually.

Signed-off-by: Miguel Pires <miguel.pires@canonical.com>
2023-01-16 14:23:11 +01:00
Samuele Pedroni
920389ac46 asserts,cmd/snap-repair: drop not pursued AuthorityDelegation/signatory-id code
in the end we went for a control assertion (snap-declaration) specific
delegation approach, instead of the generic one
2022-08-24 14:04:35 +02:00
Samuele Pedroni
b8ce8ad908 asserts: add comments about SignatoryID() not being empty when fetching 2022-02-15 11:03:00 +01:00
Samuele Pedroni
8b397923cb asserts: teach Pool about delegation 2022-02-14 15:20:29 +01:00
Paweł Stołowski
909e34c75a Check for conflicts when refreshing and commiting validation set assertions. 2021-07-12 11:13:20 +02:00
Samuele Pedroni
0109e8c283 asserts: fix some typos 2021-03-11 09:58:07 +01:00
Paweł Stołowski
9861c37af9 Cleanup the tests to make them more consistent (thanks ijohnson),
simplify addToGrouping ifs.
2021-03-02 13:08:44 +00:00
Paweł Stołowski
37828afb66 Use Fetcher in AddSequenceToUpdate. Fix addUnresolvedSeq not returning error. 2021-03-02 13:08:03 +00:00
Pawel Stolowski
07b6ed2059 asserts: pool changes for validation-sets (#9930)
Support for sequence-forming assertions in pool.
2021-03-02 12:09:21 +01:00
Paweł Stołowski
bf0b0d6158 Update error handling as error-list can have sequence key instead of
primary-key for sequence-forming assertions.
2021-02-04 11:51:53 +00:00
Paweł Stołowski
cd8cfd0c3d Update ToResolve() signature in pool and the tests. 2021-02-03 11:50:23 +00:00
Samuele Pedroni
6089162693 asserts: deserialize grouping only once in AddBatch if needed
this covers an XXX
2020-09-23 18:25:49 +02:00
Samuele Pedroni
3c93f35271 asserts: implement Pool.ClearGroups for Pool reuse
typically after specified maximum groups are exhausted
2020-09-23 18:11:40 +02:00
Samuele Pedroni
f65ca4b2b1 many: clarify code, fix/improve doc comments
thanks @bboozzoo, @stolowski
2020-06-04 14:23:57 +02:00
Samuele Pedroni
93e7abfc44 asserts: Pool.Errors 2020-05-25 16:59:55 +02:00
Samuele Pedroni
7a3054413c asserts: Pool.AddBatch
also refine Pool add phase error handling
2020-05-25 16:59:55 +02:00
Samuele Pedroni
c84424a1c4 asserts: clarify some pool.go comments
thanks @bboozzoo
2020-05-25 14:29:27 +02:00
Samuele Pedroni
c0f54573f8 asserts: use capitalization to improve sentence scanning in comment
thanks @stolowski
2020-05-20 19:20:11 +02:00
Samuele Pedroni
aa382d3603 asserts: add a test to show a corner case expected behavior 2020-05-13 09:08:31 +02:00
Samuele Pedroni
c920ae01f9 asserts: rest of the Pool API
this adds a convenience AddToUpdate method to set up assertion
refreshes via the Pool support

this also adds methods to report error trying to fetch/resolve
assertions

doc comments are expanded to cross-cover these

AddBatch is still TODO
2020-05-13 09:08:31 +02:00
Samuele Pedroni
89291d8457 asserts: make clearer that with label we mean a serialized label 2020-05-12 20:48:17 +02:00
Samuele Pedroni
9d7273f45f asserts: fix/improve doc comments for pool.go
thanks @bboozzoo
2020-05-12 17:07:42 +02:00
Samuele Pedroni
4a253b5337 asserts: clarify some pool.go code/comments, have ErrUnknownPoolGroup
thanks @stolowski
2020-05-08 10:34:43 +02:00