Skip to content

bug(authz): Fix warnings and panics appearing in tests #1112

@michalkrzyz

Description

@michalkrzyz

`•time="2026-03-05T17:31:48Z" level=info msg="Initializing authorization with OpenFGA"
time="2026-03-05T17:31:48Z" level=info msg="Added relation tuple: (user1, document1, document, owner)" event=HandleAddAuthzRelation event-step="OpenFGA AddRelation" objectId=document1 objectType=document relation=owner user=user1 userType=user
•• SUCCESS! 5.753721053s PASS
[1772731887] e2e Suite - 214/214 specs time="2026-03-05T17:31:48Z" level=error msg="Could not parse OpenFGA model file: open ./../internal/openfga/model/model.fga: no such file or directory"
time="2026-03-05T17:31:48Z" level=info msg="Starting Non Blocking HTTP Server..."
time="2026-03-05T17:31:48Z" level=error msg="Error when exeute joined callers: [refresh_mvServiceIssueCounts_proc: Error 1146 (42S02): Table 'heurekajaedqfh41a2lha2.mvServiceIssueCounts_tmp' doesn't exist]" error="Error when exeute joined callers: [refresh_mvServiceIssueCounts_proc: Error 1146 (42S02): Table 'heurekajaedqfh41a2lha2.mvServiceIssueCounts_tmp' doesn't exist]"
[HEUREKA] 2026/03/05 - 17:31:49 | 200 | 2.839041ms | ::1 | | POST "/query"
•time="2026-03-05T17:31:49Z" level=info msg="All goroutines exited cleanly."
time="2026-03-05T17:31:49Z" level=error msg="Could not parse OpenFGA model file: open ./../internal/openfga/model/model.fga: no such file or directory"
time="2026-03-05T17:31:49Z" level=info msg="Starting Non Blocking HTTP Server..."
[HEUREKA] 2026/03/05 - 17:31:49 | 200 | 811.772µs | ::1 | | POST "/query"
•time="2026-03-05T17:31:49Z" level=info msg="All goroutines exited cleanly."
time="2026-03-05T17:31:50Z" level=error msg="Could not parse OpenFGA model file: open ./../internal/openfga/model/model.fga: no such file or directory"
time="2026-03-05T17:31:50Z" level=info msg="Starting Non Blocking HTTP Server..."
[HEUREKA] 2026/03/05 - 17:31:50 | 200 | 7.488551ms | ::1 | | POST "/query"
time="2026-03-05T17:31:50Z" level=info msg="All goroutines exited cleanly."
•time="2026-03-05T17:31:50Z" level=error msg="Could not parse OpenFGA model file: open ./../internal/openfga/model/model.fga: no such file or directory"
time="2026-03-05T17:31:50Z" level=info msg="Initializing OIDC auth"
time="2026-03-05T17:31:50Z" level=info msg="Starting Non Blocking HTTP Server..."
time="2026-03-05T17:31:51Z" level=error msg="Unauthorized access: OidcAuthMethod(failed to verify signature: failed to verify id token signature)"
time="2026-03-05T17:31:51Z" level=info msg="All goroutines exited cleanly."
•time="2026-03-05T17:31:51Z" level=error msg="Could not parse OpenFGA model file: open ./../internal/openfga/model/model.fga: no such file or directory"
time="2026-03-05T17:31:51Z" level=info msg="Starting Non Blocking HTTP Server..."
time="2026-03-05T17:31:51Z" level=info msg="All goroutines exited cleanly."
•time="2026-03-05T17:31:52Z" level=error msg="Could not parse OpenFGA model file: open ./../internal/openfga/model/model.fga: no such file or directory"
time="2026-03-05T17:31:52Z" level=info msg="Starting Non Blocking HTTP Server..."
time="2026-03-05T17:31:52Z" level=info msg="All goroutines exited cleanly."
•time="2026-03-05T17:31:52Z" level=error msg="Could not parse OpenFGA model file: open ./../internal/openfga/model/model.fga: no such file or directory"
time="2026-03-05T17:31:52Z" level=info msg="Starting Non Blocking HTTP Server..."
time="2026-03-05T17:31:52Z" level=error msg="No Issue Repository found by name" default_priority=100 default_repo_name=nvd event=OnServiceCreate event-step=GetIssueRepository payload="&{0xc0000c0a00}"
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x1a6cdec]

goroutine 1841 [running]:
github.com/cloudoperators/heureka/internal/app/service.OnServiceCreateAuthz({0x2965e78?, 0xc00079acb0?}, {0x28f9ea0, 0xc00058a130}, {0x0, 0x0})
/home/runner/work/heureka/heureka/internal/app/service/service_handler_events.go:208 +0x28c
github.com/cloudoperators/heureka/internal/app/event.EventHandlerFunc.HandleEvent(0x21cd2e0?, {0x2965e78?, 0xc00079acb0?}, {0x28f9ea0?, 0xc00058a130?}, {0x0?, 0x0?})
/home/runner/work/heureka/heureka/internal/app/event/event_registry.go:22 +0x47
github.com/cloudoperators/heureka/internal/app/event.(*eventRegistry).processEvent(0xc000a4dce0, {0x28f9ea0, 0xc00058a130})
/home/runner/work/heureka/heureka/internal/app/event/event_registry.go:146 +0xfd
github.com/cloudoperators/heureka/internal/app/event.(*eventRegistry).worker(0xc000a4dce0, {0x290f378, 0xc000596910})
/home/runner/work/heureka/heureka/internal/app/event/event_registry.go:135 +0x85
created by github.com/cloudoperators/heureka/internal/app/event.(*eventRegistry).Run in goroutine 1702
/home/runner/work/heureka/heureka/internal/app/event/event_registry.go:111 +0x3b

Ginkgo ran 23 suites in 24.782124446s

There were failures detected in the following suites:
e2e ./internal/e2e
`

panic has to be avoided, as well as authz warnings should not be visible in logs not related to authz

Task Description
A clear and concise description of what the task entails.

Acceptance Criteria:

  • No warning related to authz is visible in tests related to not authz context
  • Panic should be avoided (either function is called from wrong place or it has to be guarded against nil in parameters)

Expected Test:
Add any information about how this will be tested.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions