Skip to content

Return errors instead of log.Fatal in lifecycle/adapter.go - #13

Open
magic-peach wants to merge 1 commit into
urunc-dev:mainfrom
magic-peach:fix/10-lifecycle-adapter-no-fatal
Open

Return errors instead of log.Fatal in lifecycle/adapter.go#13
magic-peach wants to merge 1 commit into
urunc-dev:mainfrom
magic-peach:fix/10-lifecycle-adapter-no-fatal

Conversation

@magic-peach

Copy link
Copy Markdown

Description

Part of #10. Covers internal/runtime/lifecycle/adapter.go: replaces its ~15 log.Fatal/log.Fatalf calls (in Prepare/CreateTask/StartTask/Stop/DeleteTask) with wrapped errors -- same reasoning as the cli_adaptor.go PR, every call site's enclosing method already returns (StageResult, error).

Issues Resolved

Updates #10 (one of four small PRs against this issue, one per file)

Testing

go build, go vet, gofmt -l, go test ./... all clean.

log.Fatal(f) calls os.Exit(1) directly, which kills the whole harness
process on a single trial's containerd error instead of letting the
orchestrator record the trial as failed and move on to the next one.

Every log.Fatal(f) call here lives inside Prepare, CreateTask,
StartTask, Stop, or DeleteTask, which already return
(harnessruntime.StageResult, error) to satisfy the Adapter interface,
so no caller changes were needed: each fatal call is replaced with
returning the underlying error wrapped with fmt.Errorf, matching the
error-wrapping style already used elsewhere in the codebase (e.g.
internal/runtime/storage/adapter.go's getOrPullImage).

Stop's dead trailing `return StageResult{}, nil` after the select
block is removed since all three select cases now return directly.

Updates urunc-dev#10

Signed-off-by: Akanksha Trehun <akankshatrehun@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant