Relevant logs and/or screenshots, environment information, etc.
LGTM but could you add some unit tests for the cases this PR is supposed to fix?
Additionally we should investigate why this test sometimes fails:
=== RUN Test_gitlabTargetManager_Reconcile_Registration_Update
{"time":"2024-06-06T16:34:19.377725874Z","level":"INFO","source":{"function":"github.com/caas-team/sparrow/pkg/sparrow/targets.(*manager).Reconcile","file":"/home/runner/work/sparrow/sparrow/pkg/sparrow/targets/manager.go","line":82},"msg":"Starting target manager reconciliation"}
{"time":"2024-06-06T16:34:19.388429797Z","level":"INFO","source":{"function":"github.com/caas-team/sparrow/pkg/sparrow/targets/remote/test.(*MockClient).PostFile","file":"/home/runner/work/sparrow/sparrow/pkg/sparrow/targets/remote/test/remotemock.go","line":53},"msg":"MockPostFile called","err":null}
{"time":"2024-06-06T16:34:19.478009469Z","level":"INFO","source":{"function":"github.com/caas-team/sparrow/pkg/sparrow/targets/remote/test.(*MockClient).FetchFiles","file":"/home/runner/work/sparrow/sparrow/pkg/sparrow/targets/remote/test/remotemock.go","line":62},"msg":"MockFetchFiles called","targets":1,"err":null}
{"time":"2024-06-06T16:34:19.478098907Z","level":"INFO","source":{"function":"github.com/caas-team/sparrow/pkg/sparrow/targets/remote/test.(*MockClient).PutFile","file":"/home/runner/work/sparrow/sparrow/pkg/sparrow/targets/remote/test/remotemock.go","line":44},"msg":"MockPutFile called","err":null}
{"time":"2024-06-06T16:34:19.578621783Z","level":"INFO","source":{"function":"github.com/caas-team/sparrow/pkg/sparrow/targets/remote/test.(*MockClient).FetchFiles","file":"/home/runner/work/sparrow/sparrow/pkg/sparrow/targets/remote/test/remotemock.go","line":62},"msg":"MockFetchFiles called","targets":1,"err":null}
{"time":"2024-06-06T16:34:19.578713224Z","level":"INFO","source":{"function":"github.com/caas-team/sparrow/pkg/sparrow/targets/remote/test.(*MockClient).PutFile","file":"/home/runner/work/sparrow/sparrow/pkg/sparrow/targets/remote/test/remotemock.go","line":44},"msg":"MockPutFile called","err":null}
{"time":"2024-06-06T16:34:19.678783951Z","level":"INFO","source":{"function":"github.com/caas-team/sparrow/pkg/sparrow/targets/remote/test.(*MockClient).FetchFiles","file":"/home/runner/work/sparrow/sparrow/pkg/sparrow/targets/remote/test/remotemock.go","line":62},"msg":"MockFetchFiles called","targets":1,"err":null}
{"time":"2024-06-06T16:34:19.678915467Z","level":"INFO","source":{"function":"github.com/caas-team/sparrow/pkg/sparrow/targets/remote/test.(*MockClient).PutFile","file":"/home/runner/work/sparrow/sparrow/pkg/sparrow/targets/remote/test/remotemock.go","line":44},"msg":"MockPutFile called","err":null}
manager_test.go:457: Reconcile() should have updated the registration twice
--- FAIL: Test_gitlabTargetManager_Reconcile_Registration_Update (0.30s)
Is there an existing issue for this?
Current Behavior
the test
Test_gitlabTargetManager_Reconcile_Registration_Update
sometimes fails. The test uses a bunch of sleeps so it might be a weird race conditionExpected Behavior
The tests pass
Steps To Reproduce
Run the test until it fails
Relevant logs and/or screenshots, environment information, etc.
Who can address the issue?
No response
Anything else?
No response