Refactor pkg/announce
package to adhere to the interfaces pattern
#3565
Labels
kind/cleanup
Categorizes issue or PR as related to cleaning up code, process, or technical debt.
kind/feature
Categorizes issue or PR as related to a new feature.
priority/important-longterm
Important over the long term, but may not be staffed and/or may need multiple releases to complete.
We follow the pattern of using interfaces to provide an option to mock parts of the implementation, e.g. see https://github.com/kubernetes/release/blob/a00489762c923fe58d7e02ea67e06c54123594e6/pkg/release/archive.go
The
pkg/announce
package doesn't follow this pattern at the moment and it's hard to write tests for it. We would like to have that tests for this package to make it easier to accept changes such as #3559To make writing tests possible, we should refactor the package to adhere to the "interfaces pattern" that we use in other packages. This issue assumes only refactoring the package, writing tests is the second step once the package is successfully refactored.
From the high level overview, we need the following:
Announce
struct that containsannounceOptions
andannounceImpl
announceOptions
struct that contains options and parameters for relevant functionsannounceImpl
interface that contains functions that should be mocked in testing (e.g. reading files...)Announce
orannounceImpl
as a receiver (e.g.func (a Announce) ...
orfunc (impl announceImpl) ...
)The text was updated successfully, but these errors were encountered: