João Reis created CASSGO-71:
-------------------------------
Summary: Make HostFilter interface easier to test
Key: CASSGO-71
URL: https://issues.apache.org/jira/browse/CASSGO-71
Project: Apache Cassandra Go driver
Issue Type: New Feature
Components: Core
Reporter: João Reis
{{// HostFilter interface is used when a host is discovered via server sent
events.}}
{{type HostFilter interface {}}
{{ // Called when a new host is discovered, returning true will cause the
host}}
{{ // to be added to the pools.}}
{{ Accept(host *HostInfo) bool}}
{{}}}
The Accept method should have an interface as the parameter instead of HostInfo
so that it is possible to mock it. Currently there are a lot of unexported
fields in HostInfo so it's not possible to create a HostInfo object with the
appropriate values for specific tests (e.g. datacenter).
{{// HostFilter interface is used when a host is discovered via server sent
events.}}
{{type HostFilter interface {}}
{{ // Called when a new host is discovered, returning true will cause the
host}}
{{ // to be added to the pools.}}
{{ Accept(host Host) bool}}
{{}}}
{{type Host interface {}}
{{Peer() net.IP}}
{{ConnectAddress() net.IP }}
{{BroadcastAddress() net.IP}}
{{ListenAddress() net.IP}}
{{RPCAddress() net.IP}}
{{PreferredIP() net.IP }}
{{DataCenter() string }}
{{Rack() string}}
{{HostID() string }}
{{WorkLoad() string}}
{{Graph() bool}}
{{DSEVersion() string}}
{{Partitioner() string }}
{{ClusterName() string}}
{{Version() cassVersion // probably needs new interface as cassVersion is
unexported}}
{{Tokens() []string}}
{{Port() int}}
{{IsUp() bool}}
{{String() string}}
{{}}}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]