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

Make Manager and Configuration an interface to ease testing #17

Open
s111 opened this issue Sep 3, 2017 · 3 comments
Open

Make Manager and Configuration an interface to ease testing #17

s111 opened this issue Sep 3, 2017 · 3 comments

Comments

@s111
Copy link
Contributor

s111 commented Sep 3, 2017

This might or might not be a good idea, but I was thinking about having Manager and Configuration be interfaces. This should be easy enough to generate but we will end up having to change the implementing structs names, which should be fine. This might ease testing when your code is coupled to the network, i.e., Gorums, as you can mock out the Manager and Configurations.

I guess my main point with doing this was that we could mock out the network layer and easier create deterministic tests with, e.g., specific interleaving of messages, network delays and patriotions. This might end up being a rather large task. Just making the Manager and Configuration be interfaces might not be that big of a deal though.

@meling
Copy link
Member

meling commented May 23, 2020

Finally started to look into this. Sounds reasonable to me. I think it would be very useful if we can make the Manager and Configuration interfaces be part of the public API of Gorums, so that these interfaces need not be generated. This can also allow us to create helper functions, e.g. test helpers, for setting up Gorums.

@meling
Copy link
Member

meling commented May 29, 2020

Here is a proposed interface for Configuration.

// Configuration represents a static set of nodes on which quorum remote
// procedure calls may be invoked.
type Configuration interface {
	Nodes() []*Node
	Size() int
	NewQuorumSpec() QuorumSpec
}

The NewConfiguration method should return the generated struct (not the interface), since then the interface does not need to contain the RPCs generated from the proto file.

The main issue is how can we access the QuorumSpec; we need generics.

@meling
Copy link
Member

meling commented Dec 21, 2020

When reviewing a PR a while back I noticed that we don't actually use the Nodes() method, nor the NodeIDs() method from within Gorums itself. The question is whether or not one or both of these methods will be useful as part of this interface.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants