Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor code to allow more unit testing #7

Merged
merged 1 commit into from
Aug 19, 2022

Conversation

mihaelabalutoiu
Copy link
Contributor

In order to allow mocking for some of the runner functions, we created a
separate interface (called PoolManagerController) with Create, Get,
Delete operations for the organization / repository pool managers.

Furthermore, a new runner struct (poolManagerCtrl) implements this new
interface. The existing code is refactored to use the poolManagerCtrl
whenever the pool managers for org / repo are handled.

This allows more unit testing for the runner functions since poolManagerCtrl
field can be mocked now.

Besides this, there are some typos fixed as well.

runner/interfaces.go Outdated Show resolved Hide resolved
runner/interfaces.go Outdated Show resolved Hide resolved
runner/interfaces.go Outdated Show resolved Hide resolved
runner/interfaces.go Outdated Show resolved Hide resolved
runner/repositories.go Outdated Show resolved Hide resolved
runner/organizations.go Outdated Show resolved Hide resolved
runner/organizations.go Outdated Show resolved Hide resolved
runner/runner.go Outdated Show resolved Hide resolved
runner/runner.go Outdated Show resolved Hide resolved
runner/runner.go Outdated Show resolved Hide resolved
In order to allow mocking for some of the `runner` functions, we created a
separate interface (called `PoolManagerController`) with `Create`, `Get`,
`Delete` operations for the `organization` / `repository` pool managers.

Furthermore, a new runner struct (`poolManagerCtrl`) implements this new
interface. The existing code is refactored to use the `poolManagerCtrl`
whenever the pool managers for `org` / `repo` are handled.

This allows more unit testing for the runner functions since `poolManagerCtrl`
field can be mocked now.

Besides this, there are some typos fixed as well.
@gabriel-samfira gabriel-samfira merged commit b74b829 into cloudbase:main Aug 19, 2022
@mihaelabalutoiu mihaelabalutoiu deleted the refactor-code branch August 19, 2022 10:12
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.

3 participants