1
0
Fork 0
mirror of https://code.forgejo.org/forgejo/runner.git synced 2025-09-15 18:57:01 +00:00

feat: insert the daemon context in the poller context

The daemon context is needed when the context of a job or the poller
is done. Otherwise it is no longer possible to send a conclusion
report to Forgejo, short of creating a context.Background() which
poses its own set of problems.

- WithDaemonContext is used to store the daemon context
- The poller uses the daemon context instead of context.Background
This commit is contained in:
Earl Warren 2025-08-16 19:13:32 +02:00
parent fccf857bce
commit d114f3646d
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
5 changed files with 37 additions and 8 deletions

View file

@ -118,7 +118,7 @@ func setTrace(t *testing.T) {
}
func TestPoller_New(t *testing.T) {
p := New(&config.Config{}, &mockClient{}, &mockRunner{})
p := New(t.Context(), &config.Config{}, &mockClient{}, &mockRunner{})
assert.NotNil(t, p)
}
@ -172,6 +172,7 @@ func TestPoller_Runner(t *testing.T) {
}
p := &mockPoller{}
p.init(
t.Context(),
&config.Config{
Runner: configRunner,
},
@ -239,6 +240,7 @@ func TestPoller_Fetch(t *testing.T) {
}
p := &mockPoller{}
p.init(
t.Context(),
&config.Config{
Runner: configRunner,
},