This is needed in a few places, and it's nominally more efficient to
get all runs with one SELECT, than first get all run ids and then each
run one by one.
Signed-off-by: Lars Wirzenius <liw@liw.fi>
This is primarily going to be useful for setting up runs in the
database for testing report generation, which will happen in the near
future.
Signed-off-by: Lars Wirzenius <liw@liw.fi>
It's a "refsFetched" node event, not a trigger message. The name was
the last remaining remnant of an earlier approach to verifying the CI
broker.
Signed-off-by: Lars Wirzenius <liw@liw.fi>
Change the "smoke test" scenario so it passes.
Fix set-rid (embedded in ci-broker.md). Previously the input ref name
was just prefixed with "refs/namespaces/{nid}", but this resulted in
an input value that referenced a namespace to become a ref to a
namespace in a namespace, which isn't sensible for what we're doing.
Change this to replace only the namespace NID in the input with the
NID we're testing with. For simplicity, assume the input NID is
"DUMMYNID".
If I was sensible, I'd write a helper library to make this better.
Signed-off-by: Lars Wirzenius <liw@liw.fi>
ci-broker.md: fix smoke test scenario
Signed-off-by: Lars Wirzenius <liw@liw.fi>
Previously, we output an Option, but now we output what's contained in
the option, or an explicit "no such event". This helps output to be
easier to understand for users, and simplifies testing, too.
Signed-off-by: Lars Wirzenius <liw@liw.fi>
Add a couple of helper scripts to make scenarios a little less
repetitive. These aren't great for understanding, and we may need to
add more understandable steps later.
Signed-off-by: Lars Wirzenius <liw@liw.fi>
Make BrokerEvent de-serializable so that we can store them as JSON in
the database in the persistent event queue.
Signed-off-by: Lars Wirzenius <liw@liw.fi>
Add a "counter" table, to enable a rudimentary concurrency test. Used
this to verify that multiple processes can safely update the same
database. Multi-process concurrency can result in temporary, short
lived lock conflicts in transactions: deal with this by re-trying for
a short duration.
Add a persistent event queue. Add methods to the Db type to deal with
counters and event queue.
Add a new error type to allow Db methods to return errors that do not
come from SQLite.
Restructure the internals a bit to make them easier for me to follow.
I don't understand how the old could ever have worked. Maybe I don't
understand what's going on. The tests should help, in the future.
Signed-off-by: Lars Wirzenius <liw@liw.fi>