Skip to content

sse: nil instead of empty list returned by getJobsByIdentifier() in kubernetes.go #361

@andmat900

Description

@andmat900

Description

From sse logs when starting a v1alpha testrun:

67cfcbf-49x8d name="ETOS API" version=35795d426b8ef0b1d11a0956798856f30d57da02
2025/02/05 09:39:43 http: panic serving 10.42.0.5:46434: runtime error: invalid memory address or nil pointer dereference
goroutine 97 [running]:
net/http.(*conn).serve.func1()
	net/http/server.go:1903 +0xbe
panic({0x15b0600?, 0x25577a0?})
	runtime/panic.go:770 +0x132
github.com/eiffel-community/etos-api/internal/kubernetes.(*Kubernetes).IsFinished(0xc00046c300, {0x19e2c40, 0xc0000ded70}, {0xc00004ab53, 0x24})
	github.com/eiffel-community/etos-api/internal/kubernetes/kubernetes.go:106 +0x122
github.com/eiffel-community/etos-api/pkg/sse/v1.SSEHandler.GetEvents({0xc0004521c0, {0x7f90fae00ad8, 0xc000440680}, {0x19e2c40, 0xc00044f450}, 0xc00046c300}, {0x19d5590, 0xc000136620}, 0xc0001a8900, {0xc0002902e0, ...})
	github.com/eiffel-community/etos-api/pkg/sse/v1/sse.go:226 +0x185
github.com/julienschmidt/httprouter.(*Router).ServeHTTP(0xc00044a960, {0x19d5590, 0xc000136620}, 0xc0001a8900)
	github.com/julienschmidt/httprouter@v1.3.0/router.go:387 +0x7eb
net/http.serverHandler.ServeHTTP({0xc000716b70?}, {0x19d5590?, 0xc000136620?}, 0x6?)
	net/http/server.go:3142 +0x8e
net/http.(*conn).serve(0xc000130b40, {0x19e2c08, 0xc00046c5d0})
	net/http/server.go:2044 +0x5e8
created by net/http.(*Server).Serve in goroutine 8
	net/http/server.go:3290 +0x4b4

Additional Context

No response

Logs

Expected Behavior

IsFinished() shall return an empty list if no job has been found by identifier.

Steps To Reproduce

No response

The version of this project/repo, if applicable

No response

The version/edition of the Eiffel Protocol used, if applicable

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions