Skip to content

Commit

Permalink
test(konnect): Add SDKWrapper to allow using mock SDK in reconcilers (#…
Browse files Browse the repository at this point in the history
…543)

* refactor(konnect): add SDK interface types for each entity type

* tests: add mockery for Konnect SDK

* tests: add mocks for KongService SDK

* add plugin SDK interface and mock

* refactor SDKFactory to allow using mock SDK in reconcilers

* add mocks for all submodules of Konnect SDK

* move mock SDK code to *_mock.go to allow them being imported by other packages

* Update controller/konnect/reconciler_generic_test.go

Co-authored-by: Grzegorz Burzyński <[email protected]>

---------

Co-authored-by: Patryk Małek <[email protected]>
Co-authored-by: Grzegorz Burzyński <[email protected]>
  • Loading branch information
3 people authored Sep 5, 2024
1 parent a3d0a24 commit 0ace883
Show file tree
Hide file tree
Showing 20 changed files with 1,393 additions and 72 deletions.
5 changes: 5 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -146,3 +146,8 @@ issues:
linters:
- revive
text: "exported: exported"
# Generated mock SDKs does not need comments on generated methods.
- path: controller/konnect/ops/.*_mock\.go
linters:
- revive
text: "exported: exported"
7 changes: 6 additions & 1 deletion .mockery.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ inpackage: True
disable-version-string: True
with-expecter: True

filename: "{{ trimSuffix .InterfaceFile \".go\" | base | lower }}_mock_test.go"
filename: "{{ trimSuffix .InterfaceFile \".go\" | base | lower }}_mock.go"
dir: "{{ .InterfaceDir }}"
mockname: "Mock{{ .InterfaceName }}"
outpkg: "{{ .PackageName }}"
Expand All @@ -13,3 +13,8 @@ packages:
interfaces:
ControlPlaneSDK:
ServicesSDK:
RoutesSDK:
ConsumersSDK:
ConsumerGroupSDK:
PluginSDK:
MeSDK:
File renamed without changes.
264 changes: 264 additions & 0 deletions controller/konnect/ops/kongconsumer_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 0ace883

Please sign in to comment.