mirror of
https://gitea.com/gitea/act_runner.git
synced 2026-10-31 20:37:43 +08:00
Ephemeral registrations are single-use, but the daemon kept `.runner` after the task, so a restarted container failed `Declare` with `unregistered runner` forever. An ephemeral runner now removes its registration file as soon as it fetches a task, so a container killed mid-job registers afresh on restart. It also removes the file when Gitea answers `unregistered runner` at startup or while polling. A proxy's 401 does not count. Persistent runners keep their file, because Gitea sends the same reply for a token mismatch. Closes https://gitea.com/gitea/runner/issues/818 --------- Co-authored-by: silverwind <me@silverwind.io> Reviewed-on: https://gitea.com/gitea/runner/pulls/1256 Reviewed-by: silverwind <2021+silverwind@noreply.gitea.com>
29 lines
617 B
Go
29 lines
617 B
Go
// Copyright 2026 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
//go:build e2e
|
|
|
|
package e2e
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
func testEphemeralRunner(t *testing.T) {
|
|
t.Parallel()
|
|
api, repo, poller := startIsolatedScenario(t, "ephemeral.yml", "e2e-ephemeral", runnerOptions{ephemeral: true})
|
|
|
|
wfRun := waitForRun(t, api, repo)
|
|
requireSuccess(t, api, repo, wfRun.ID)
|
|
|
|
select {
|
|
case <-poller.Done():
|
|
case <-time.After(5 * time.Second):
|
|
t.Fatal("ephemeral runner was not deleted")
|
|
}
|
|
if !poller.RegistrationRejected() {
|
|
t.Fatal("ephemeral runner stopped without being deleted")
|
|
}
|
|
}
|