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

Lay groundwork for mocking and add initial workceptor unit tests #785

Merged
merged 1 commit into from
Jun 28, 2023

Conversation

AaronH88
Copy link
Contributor

@AaronH88 AaronH88 commented May 26, 2023

Addresses issue #796

// Netceptor is a interface to decouple workceptor from netceptor.
// it includes only the functions that netceptor uses.
// the interface name is work in progress.
type Netceptor interface {
Copy link
Contributor Author

@AaronH88 AaronH88 Jun 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The golang naming convention for interfaces is to use an er postfix, and while this works in most cases Netceptorer is difficult to read.
I originally had the interface name as a name pairing, outlining the interface relationship they represent, however WorkceptorsNetceptor while intuitive is overly verbose.
Other languages have the i convention, and while INetceptor would be easy to understand, it breaks the golang naming convention and is overly verbose, with i and interface both being written on the same line.

@shanemcd had the suggestion of using just Netceptor. It is the cleanest to look at however, not the most obvious to understand the relationship. The reader needs to understand that in order to call the concrete netceptor then namespace syntax needs to be used, e.g. netceptor.Netceptor, and also needs to understand the current package, and that this interface is implemented in the netceptor package.

I am leaning toward following Shanes suggestion, and hoping that any readers of the code base will pick up that the interface keyword is on this line and understand its special meaning.

@shanemcd shanemcd changed the title Add mocks and workceptor unit tests Lay groundwork for mocking and add initial workceptor unit tests Jun 26, 2023
@AaronH88 AaronH88 merged commit 8d5dcca into ansible:devel Jun 28, 2023
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.

1 participant